-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor all HTTP requests into client classes #37
Conversation
* Let JsonClient._log_http_error handle everything
* Keep a default endpoint in the base class, add a kwarg for specifying a different endpoint. * Add get_json() method to perform a GET request expecting a JSON response.
* Move new Consul get k/v method to client
* Only try get JSON content if OK response code * Add new UnexpectedResponseError type * Handle 404's that should be ignored in main Consular class * Add tests
ping 🔔 |
Get the response JSON content if the respones code is OK (200), else | ||
raise an `UnexpectedResponseError`. | ||
""" | ||
if response.code == OK: |
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.
The full range of 2xx
is essentially OK, does OK
cover these?
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.
It doesn't look like it http://twistedmatrix.com/trac/browser/tags/releases/twisted-15.4.0/twisted/web/_responses.py
👍 |
Refactor all HTTP requests into client classes
Supersedes #35, comparing against
develop
this time.