-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Using the format=json uri parameter with cat api calls fails #4243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting @CraigWh. This looks like a bug caused by the strictness of the response MIME type against the MIME type that was requested. We'll look at addressing this |
For now, you can set the var response = await client.Cat.MasterAsync<StringResponse>(new CatMasterRequestParameters {
RequestConfiguration = new RequestConfiguration
{
ContentType = RequestData.MimeType,
Accept = RequestData.MimeType
}
}); To be clear, the call using |
This commit updates the ApiGenerator to set the Accept HTTP header when the format header is specified. To determine whether an API call is successful, the Content-Type header of the response is checked against the Accept header of the request. The format parameter only really makes sense for the low level client and associated ElasticsearchResponse<T> types, as the high level client always expects to deserialize from JSON; any other format will result in an exception at deserialization. Fixes #4243
I've opened #4269 to address. |
* Set Accept header when format set on Cat APIs This commit updates the ApiGenerator to set the Accept HTTP header when the format header is specified. To determine whether an API call is successful, the Content-Type header of the response is checked against the Accept header of the request. The format parameter only really makes sense for the low level client and associated ElasticsearchResponse<T> types, as the high level client always expects to deserialize from JSON; any other format will result in an exception at deserialization. Fixes #4243 * Addressed PR comments
NEST/Elasticsearch.Net version: 7.2.1
Elasticsearch version: 7.2.1
Description of the problem including expected versus actual behavior: Using the Cat.MasterAsync API and specifying the Format="JSON" parameter returns a response object that has the Success flag set to false but has a status code of 200 and the correct response body. Calling the same method in Elasticsearch.Net 6.8 worked as expected.
I am calling the API like this (this.client is of type IElasticLowLevelClient):
Provide
ConnectionSettings
(if relevant):Using a SingleNodeConnectionPool
Specifying DisableAutomaticProxyDetection and DisablePing
Provide
DebugInformation
(if relevant):The text was updated successfully, but these errors were encountered: