-
Notifications
You must be signed in to change notification settings - Fork 106
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
status 201 should not throw error by default #128
Comments
I face the same issue. Though this is easy to handle, just add 201 to statusCodes. But I rather expect to see 201 or other codes to be returned in the response/resultant object. |
I expect everyone will have this issue, 201 is a successful response and endpoints may return 201 or 200 and it could change at any time by whoever runs the endpoint, better to default to 201 allowed because everyone will need to add it in |
I just not sure letting other results to be caught is a good idea. It works, and there exist work arounds. But is it elegant? 202 : some IOT , rest DELETE may return this. These are not errors. I am used to think 4XX / 5XX as error. I can understand 3XX usually lead to extra operations. But I think 202, or in general 2XX, shall be accepted by default |
It should honor the definition of HTTP status code. |
This is how the lib was designed. You should pass to const client = bent(200,201,202,203,204,301,302...); This not an issue, but rather a design decision. |
Adding a better understandable error is also better for the dev experience. Yesterday I was stuck on.
You have an error! Really confusing in my opinion (at least for me). I'm not against throwing an error. But an error like below should help devs understand why they're getting an error. Maybe just only output this error if there is a 2XX HTTP code.
|
@AlexSpelt that's a good point. I liked the first part of your proposed error message. What do you think of rephrasing the 2nd part a bit, like:
|
That is even better indeed. Except for the "201 status code" part instead of "status code 201". But that might be the language barrier for me. English is not my native language. |
201 status code:
This is a successful status response and is commonly used for post request responses, it should not throw error by default
The text was updated successfully, but these errors were encountered: