-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
An incredibly arcane missing header in response to a POST #19079
Comments
lets fix it - thanks for reporting.. the location should just be the |
In the case of jeffsilverm.ddns.net:9200/customer/external?pretty' -d ' I my example, elasticsearch returns HTTP/1.1 201 Created { I believe the resulting header should be HTTP/1.1 201 Created The use case is the ability to create a list of pointers to documents in a Thank you Jeff On Fri, Jul 1, 2016 at 2:24 AM, Simon Willnauer notifications@github.com
Jeff Silverman, linux sysadmin |
This adds a header that looks like `Location: /test/test/1` to the response for the index/create/update API. The requirement for the header comes from https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html https://tools.ietf.org/html/rfc7231#section-7.1.2 claims that relative URIs are OK. So we use an absolute path which should resolve to the appropriate location. Closes elastic#19079 This makes large changes to our rest test infrastructure, allowing us to write junit tests that test a running cluster via the rest client. It does this by splitting ESRestTestCase into two classes: * ESRestTestCase is the superclass of all tests that use the rest client to interact with a running cluster. * ESClientYamlSuiteTestCase is the superclass of all tests that use the rest client to run the yaml tests. These tests are shared across all official clients, thus the `ClientYamlSuite` part of the name.
Is a 201 response with no content required to include "Content-Length: 0" ? |
Elasticsearch version: 2.3.3
JVM version:
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
OS version:
Linux jeff-desktop 4.4.0-24-generic #43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
(Ubuntu 16.04)
Description of the problem including expected versus actual behavior:
This is going to sound incredibly arcane. There is a missing header in the response to a successful PUT. The following curl commands work exactly as they are supposed to, there is no problem there.
The problem is that, according to RFC 2616 section 10.2.2, (https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) the Location header should be included in the 201 response:
Steps to reproduce:
1.
curl -i -XPOST 'jeffsilverm.ddns.net:9200/customer/external?pretty' -d ' { "name": "Bob" }' | fgrep -i Location
returns nothing.
3.
Describe the feature:
There should be a Location header. In the example above, the URL 'jeffsilverm.ddns.net:9200/customer/external/AVWLn7k00A40HdQsPZ78?pretty' works flawlessly.
The only problem is the missing Location field in the returned HTTP header when doing the POST. Note that since the GET returns status code 200 (correctly), no Location header is required by RFC 2616. The POST returns status code 201 (correctly), and that is where the Location header is required.
The work around is to parse the response and look for the _id field, which can be done using jq or the python json.loads method. So I believe that this is a very low priority issue.
The text was updated successfully, but these errors were encountered: