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

return no content status (204) for succesful write #2298

Merged
merged 3 commits into from
May 12, 2015

Conversation

neonstalwart
Copy link
Contributor

since write returns nothing in the body of the response, return 204

related to #2266

@neonstalwart
Copy link
Contributor Author

i got caught... for some reason i can't get the tests running locally 😄 (looking at it now)

@otoolep
Copy link
Contributor

otoolep commented Apr 16, 2015

I suspect we'll end up soon outputting some data in response to a write, so this might be premature.

@neonstalwart
Copy link
Contributor Author

this might be premature.

no problem. if determining what to provide in the response is something you think you will get around to doing later but don't have time for now, then maybe having an open issue will help make sure it doesn't get overlooked. i had opened #2266 to try and determine what you might like to respond with because if you can give some direction, i might be able to implement it. however, when #2266 was closed, i was left the impression that an empty response is what it will be for now so i made this PR to do the right thing for an empty response.

maybe this PR could be merged in case you don't get around to deciding what to respond with before you release 0.9.0? maybe you don't agree with these changes for an empty response? i don't mind closing this PR but i'd like to help on providing some kind of better response than what is currently provided.

@toddboom
Copy link
Contributor

@neonstalwart would you mind rebasing this?

@neonstalwart
Copy link
Contributor Author

@toddboom rebased.

toddboom added a commit that referenced this pull request May 12, 2015
return no content status (204) for succesful write
@toddboom toddboom merged commit 0854913 into influxdata:master May 12, 2015
@toddboom
Copy link
Contributor

@neonstalwart awesome - thanks!

@neonstalwart neonstalwart deleted the write-204-status branch May 12, 2015 19:40
vladlopes added a commit to vladlopes/influxdb that referenced this pull request May 13, 2015
The write endpoint is returning StatusNoContent instead of StatusOK
when the write is successful.
toddboom added a commit that referenced this pull request May 13, 2015
@contentfree
Copy link

This seems to now to be broken according to RFC7320

A server MUST NOT send a Transfer-Encoding header field in any response with a status code of 1xx (Informational) or 204 (No Content).

The server still seems to be sending back the header transfer-encoding: chunked which it should not. This can cause problems with many HTTP libraries as well as several servers. Visit this stackoverflow question for more info.

@romikk
Copy link

romikk commented Jun 23, 2015

Could someone update docs here?
https://influxdb.com/docs/v0.9/concepts/reading_and_writing_data.html
At the moment it says successful write would return HTTP 200 OK

@beckettsean
Copy link
Contributor

@romikk Thanks for the note, I opened an issue on the website repo: https://github.com/influxdb/influxdb.com/issues/62

@beckettsean
Copy link
Contributor

No longer sending a transfer-encoding value:

$  curl -iv -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'foo value=12';
*   Trying ::1...
* Connected to localhost (::1) port 8086 (#0)
> POST /write?db=mydb HTTP/1.1
> Host: localhost:8086
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 12
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 12 out of 12 bytes
< HTTP/1.1 204 No Content
HTTP/1.1 204 No Content
< Request-Id: 6162708c-5d8f-11e5-8771-000000000000
Request-Id: 6162708c-5d8f-11e5-8771-000000000000
< X-Influxdb-Version: 0.9.4.1
X-Influxdb-Version: 0.9.4.1
< Date: Thu, 17 Sep 2015 22:56:50 GMT
Date: Thu, 17 Sep 2015 22:56:50 GMT

< 
* Connection #0 to host localhost left intact

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.

6 participants