Skip to content
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

gzipped requests omit content-type header #295

Open
ththvseo opened this issue Dec 13, 2017 · 0 comments
Open

gzipped requests omit content-type header #295

ththvseo opened this issue Dec 13, 2017 · 0 comments

Comments

@ththvseo
Copy link

we are seeing lots of:
[WARN][RestController ] Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header.
from elasticsearch.

it is probably a general issue that the header is not added, especially for non-json payloads,

but spefically the code for gzip compression, as introduced here:
https://github.com/mattbaird/elastigo/pull/263/files
omits setting the Content-Type header.
unlike the pre-existing SetBodyJson(), the newly added SetBodyGzip() is missing the logic for setting that header.
a quick solution should be to add the header when generating json, as in SetBodyJson():

	switch v := data.(type) {
	default:
             b, err := json.Marshal(data)
+           r.Header.Set("Content-Type", "application/json")
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

No branches or pull requests

1 participant