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
POST and ETag header #620
POST and ETag header #620
Comments
Confirmed: $ curl --verbose -X POST -H "Content-Type: application/json" http://127.0.0.1:15984/foo -d '{"am":"joan"}'
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 15984 (#0)
> POST /foo HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 127.0.0.1:15984
> Accept: */*
> Content-Type: application/json
> Content-Length: 13
>
* upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 201 Created
< Cache-Control: must-revalidate
< Content-Length: 95
< Content-Type: application/json
< Date: Mon, 26 Jun 2017 19:45:42 GMT
< Location: http://127.0.0.1:15984/foo/263cad76416a130feb97e26cb400084a
* Server CouchDB/2.1.0-3559b7f (Erlang OTP/17) is not blacklisted
< Server: CouchDB/2.1.0-3559b7f (Erlang OTP/17)
< X-Couch-Request-ID: acdbe8171b
< X-CouchDB-Body-Time: 0
<
{"ok":true,"id":"263cad76416a130feb97e26cb400084a","rev":"1-c29e0faaccb770dc8964a43d22825195"}
* Connection #0 to host 127.0.0.1 left intact
$ curl --verbose -X PUT -H "Content-Type: application/json" http://127.0.0.1:15984/foo/bar -d '{"bread":"makes you fat"}'
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 15984 (#0)
> PUT /foo/bar HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 127.0.0.1:15984
> Accept: */*
> Content-Type: application/json
> Content-Length: 25
>
* upload completely sent off: 25 out of 25 bytes
< HTTP/1.1 201 Created
< Cache-Control: must-revalidate
< Content-Length: 66
< Content-Type: application/json
< Date: Mon, 26 Jun 2017 19:46:36 GMT
< ETag: "1-4cd6186966b5c93e45a3f878d6029f67"
< Location: http://127.0.0.1:15984/foo/bar
* Server CouchDB/2.1.0-3559b7f (Erlang OTP/17) is not blacklisted
< Server: CouchDB/2.1.0-3559b7f (Erlang OTP/17)
< X-Couch-Request-ID: cdbe78e97c
< X-CouchDB-Body-Time: 0
<
{"ok":true,"id":"bar","rev":"1-4cd6186966b5c93e45a3f878d6029f67"}
* Connection #0 to host 127.0.0.1 left intact |
I think the docs are at fault here. I don't think it's right to return an ETag header from POST /dbname as the etag is related to the /dbname/newdocid resource not the /dbname resource. |
and further noting that the point of ETag response is for caching, and ~nothing caches POST responses (and for good reason). |
citing https://tools.ietf.org/html/rfc7231#section-7.2 as my basis for this claim.
clearly the thing represented by /dbname was not replaced by the request body (a document) posted to it. |
That may be true, but we did it in 1.6:
|
I was trying to build 1.6.1 this last hour, without success, to see if this was a regression, so thanks for that. |
I'm closing this one as "works as designed" assuming that apache/couchdb-documentation#139 will hit in the next day or two. |
Travis dialyze
* POST /dbname should not return ETag response header as it relates to a different resource. Note: We used to send ETag for this in previous releases, so it's technically a regression even though we accidentally fix a spec violation. Closes #620 * Document loss of ETag in POST as breaking change in 2.0
* POST /dbname should not return ETag response header as it relates to a different resource. Note: We used to send ETag for this in previous releases, so it's technically a regression even though we accidentally fix a spec violation. Closes apache#620 * Document loss of ETag in POST as breaking change in 2.0
When performing a POST to store a new document, there are no ETag headers returned. For PUT there is. Docs says there should be: http://docs.couchdb.org/en/2.0.0/api/database/common.html#post--db
The text was updated successfully, but these errors were encountered: