-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: Added enumeration of HTTP response status codes #303
Conversation
This is fine so far, though the main thing to resolve for this issue is to make our server return different response codes for invalid url combinations. Currently every combination of parameters gives a 200 response, but there are some possible error cases where it is not "ok" and should set the http response code to something else. For example:
|
@DenverCoder1 As I understand it, you need query validation. In addition to statuses, maybe it can also return the error text? For example, if some parameter is missing, then write |
It already displays error messages, it just doesn't have different status codes for different errors, for example, this page shows the response code is 200, when it would be more accurate to say 422 since there was an error One possible way to do this could be to pass the codes to the exceptions, and call This is a PR to a similar issue in a different repository for reference: https://github.com/DenverCoder1/github-readme-streak-stats/pull/192/files |
I didn't display an error message when I failed to get the font. This could cause animations to crash for some users. In the current version, if you can't get the desired font, the default font is used |
Thanks so much for all the work you've put in to solving this! While this does work, as far as the implementation, there are a few things I'd do differently for code readability and maintainability. Constructors should not typically have side effects, in other words, using the construction of the exception to change the response code is unexpected and as a principle should be avoided. I think the most expected place to find this would be in the
Feel free to let me know your thoughts and if you have any questions. Thanks |
Quite a good point! I'll fix it |
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.
Thanks for the continued work, looks great so far
Thank you for your attention to my work and valuable comments! I took all your recommendations into account and corrected the errors |
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.
Looks perfect! Thanks for the contribution 🎉
Summary
Added enumeration of HTTP response status codes
Resolves #59
Type of change
How Has This Been Tested?
composer test