Re:I've been abusing HTTP Status Codes in my APIs for years
by SahAssar on Wednesday July 13, 2022 @12:46PM
(#32085250)
> Did I mention that httpClient, by default, doesn't let you get 404 error bodies?
Why would a http client not let you get http response bodies for statuses that usually send bodies? I could understand it for a 201, and definitely for a 204, but for a 404 it just seems like bad design of the client.
Re:I've been abusing HTTP Status Codes in my APIs for years
by dragonwriter on Wednesday July 13, 2022 @12:30PM
(#32084966)
What I am hearing is “Angular httpClient is badly defined”, which is the kind of risk you run into a lot with big monolithic highly-opinionated frameworks.
Did I mention that httpClient, by default, doesn't let you get 404 error bodies?
But ultimately, it is all just ideas on 'how neat it would it be to use codes!' when in practice it is so so much better to just drop it and use the codes for more literal values. Imagining a users/{X} as a 404 for invalid 'X' is fun..but like..the server actually defines it as something like /users/:userId and it isn't actually an invalid route and will not be caught by the default 404 handling. It's a conceptual dance.