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

Do not signal error on successful non-200 HTTP status codes #17

Closed
josephmturner opened this issue Jan 17, 2023 · 6 comments
Closed

Do not signal error on successful non-200 HTTP status codes #17

josephmturner opened this issue Jan 17, 2023 · 6 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@josephmturner
Copy link
Contributor

Currently, plz.el signals plz-http-error on anything besides a status 200 code. According to Mozilla, only status codes between 400-599 are errors.

I was confused when I received a successful 201 status code and plz.el signaled an HTTP error.

@josephmturner josephmturner changed the title More granular reporting of HTTP status codes Do not signal error on successful non-200 HTTP status codes Jan 17, 2023
@alphapapa
Copy link
Owner

Hi Joseph,

Yes, this is an artifact of plz being relatively new and not having needed to interact with other 2xx codes before. Issue #7 is also related to this.

The question now is how to handle other 2xx codes. I guess we could simply treat them the same as 200, and clients that need to handle specific 2xx codes differently could use :as 'response and check the code in the :then function.

What do you think? Thanks.

@alphapapa alphapapa added bug Something isn't working enhancement New feature or request labels Jan 20, 2023
@alphapapa alphapapa added this to the 0.4 milestone Jan 20, 2023
@Dima-369
Copy link

The question now is how to handle other 2xx codes. I guess we could simply treat them the same as 200, and clients that need to handle specific 2xx codes differently could use :as 'response and check the code in the :then function.

That sounds great! I vote for this :)

Once this is implemented, it would be great if this is noted in the README with an example of how to check for the status code!

@josephmturner
Copy link
Contributor Author

The question now is how to handle other 2xx codes. I guess we could simply treat them the same as 200, and clients that need to handle specific 2xx codes differently could use :as 'response and check the code in the :then function.

I like this simple solution. If at some point it seems appropriate for plz.el to handle specific 2xx codes, that can be implemented later.

@josephmturner
Copy link
Contributor Author

Thank you!

@alphapapa
Copy link
Owner

Going to reopen this to remind me to update the docs as mentioned.

@alphapapa alphapapa reopened this Feb 7, 2023
@alphapapa alphapapa self-assigned this Feb 7, 2023
@alphapapa alphapapa added the documentation Improvements or additions to documentation label Feb 7, 2023
@alphapapa
Copy link
Owner

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants