-
Notifications
You must be signed in to change notification settings - Fork 16
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
deregisterService uses PUT method instead of GET #48
Conversation
I also added a datacenter parameter to the deregisterService function. I don't know if this is right. I'd be happy to remove that change if you don't think it's right. Of course, this is a breaking change to the API. Though, I imagine not that many people are using this function because it was broken 😂 |
I've tested this on my local machine. It looks like CI is broken... |
Any thoughts on this @ketzacoatl ? |
Hi @wraithm, Thank you for the PR and write up. I was away for the weekend and am only now seeing the notifications. I have been wanting to get back into dev here, so it's nice to have the nudge :) You raise some good questions. It has been quite some time since I last reviewed the details, and I'd like a couple days to look them over again, but here are a couple initial thoughts:
|
OK, AFAICT, the Here is the olded version we still test the library with:
Here's an even older version:
That is nice.. and simplifies our next steps. |
I believe it's always accepted PUT, but it used to also accept GET, and then they deprecated that. |
Ah, yes, good catch! I had searched for GET in The latest version I could find GET for
And it's gone in 1.0:
Given that it's not in 1.0, I don't think we need to worry about supporting it. |
Btw, it looks like several endpoints in the consul-haskell package had the same change: they used to make GET reqs, then they got changed to PUT. It just looks like deregister got missed somehow. I used the function that the other requests use to make PUT reqs. This GET -> PUT requirement has clearly been an issue in the past for this lib. |
Yea, it was probably missed due to not having tests. That's why getting tests for each implemented API has been a priority, though that effort then got bogged down in consistency and ergonomic updates. It's just a bunch of work to slug through :) Thanks for the help with this so far! |
Yeah, I'll take care of that in 2 secs |
Previously, the deregisterService used a GET request to the deregister endpoint. Consul requires that this must be a PUT request now. This change converts the request into a PUT request using the createRequest convention that empty string request bodies are PUT requests. This change also adds a test for deregisterService. A service is created, then destroyed, and confirmed that the service was removed. This change also fixes a minor bug in the testRegisterService. It did not check that the list returned wasn't empty. If the list of services is empty, it also wasn't created.
Fantastic! Do you want to bump the lib version to |
Thank you for the contribution! |
Thanks! |
Previously, the deregisterService used a GET request to the deregister
endpoint. Consul requires that this must be a PUT request now. This
change converts the request into a PUT request using the createRequest
convention that empty string request bodies are PUT requests.
This change also adds a test for deregisterService. A service is
created, then destroyed, and confirmed that the service was removed.
This change also fixes a minor bug in the testRegisterService. It did
not check that the list returned wasn't empty. If the list of services
is empty, it also wasn't created.
Closes #47