-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
nsqd: http api inconsistencies #330
Conversation
Another small thing: responds with 500 for an invalid topic, could be a 400 |
Yea, this stuff could certainly be improved, thanks. I'm going to clump this into the proposed work to version the HTTP endpoints that came from the other issue you reported in #308, we can do this work at the same time. |
Cool if I get some time I'll try and help with these, another really minor thing is supporting Accept over (or in addition to) |
Ok, pushed some code for review... If anyone else has opinions speak up now! This implements:
cc @jehiah |
LGTM! |
thanks, also in case it wasn't obvious this change preserves all of the existing endpoints and semantics, to be officially dropped in |
RFR @jehiah |
i had some of this conversation with @mreiferson offline, but the gist is: If we want to migrate our public api to a new response format, and provide a transition period for clients to opt-in to the new format we could do that with This seems more appealing as we would have a time where endpoints would respond in either format, clients could update to opt in to the new format, then we can drop the old format. This also provides a path if/when we need to make backwards incompatible changes on a single endpoint and allows us to do so without ending up with a single endpoint in There is also an appealing part about using Accept header in that a client can opt in to the new format, but can also still talk to old endpoints fairly gracefully to allow for a slow migration. |
|
||
case "/v1/stats": | ||
s.v1StatsHandler(w, req) | ||
case "/v1/ping": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was intentional, /v1/stats
returns the version - seemed superfluous
Anyone else care to weigh in? I don't really care much whether we use a prefix I'm mostly interested in the response format change and the other endpoint renaming changes I did here, which we can do regardless of the choice for specifying a version. |
I'm impartial, I don't think either is inelegant, pathname is nice and curl-able that's about it |
updated for |
@jehiah ping |
LGTM you want this in as is? |
nah, I'll squash |
* drop response wrapper * use correct HTTP codes * use Accept header to indicate version
ok, ready |
@mreiferson it occurs to me that we missed updating api endpoints in nsqlookupd w/ this new response format. Care to open up a PR to match response handling there? |
@jehiah good call, |
I didn't think |
I was more referring to its interaction with |
speaking for my own ease of deploying, i'd like to get a version of nsqd build and deployed w/ new response formats available prior to the switch to use them from nsqadmin. (or i suppose the flip side is having it still fall back to accept the old response type) |
It'll be backwards compatible (just prefer the new format) |
It's a little weird to use GETs, but the docs don't mention which verb to use. It would be nicer to have
DELETE host/topic/test
or the POST at least just for consistency, POSTS are definitely more curl-friendly so maybe going full "rest" (meh) is not worth it