Skip to content

Set Accept header when format set on Cat APIs #4269

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

Merged
merged 2 commits into from
Dec 17, 2019
Merged

Set Accept header when format set on Cat APIs #4269

merged 2 commits into from
Dec 17, 2019

Conversation

russcam
Copy link
Contributor

@russcam russcam commented Dec 13, 2019

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 types, as the high level client always expects to deserialize
from JSON; any other format will result in an exception at deserialization.

Fixes #4243

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
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I do have two nitpicks though

@russcam
Copy link
Contributor Author

russcam commented Dec 17, 2019

I've addressed the PR comments, if you wouldn't mind having another look @Mpdreamz

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mpdreamz Mpdreamz merged commit 7cb539a into 7.x Dec 17, 2019
@Mpdreamz Mpdreamz deleted the fix/4243 branch December 17, 2019 11:38
Mpdreamz pushed a commit that referenced this pull request Dec 17, 2019
* 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

(cherry picked from commit 7cb539a)
@Mpdreamz
Copy link
Member

ported to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants