Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
landryraccoon
on July 13, 2022
|
parent
|
context
|
favorite
| on:
I've been abusing HTTP Status Codes in my APIs for...
In the case of a missing user ID, if a more verbose response is desirable, why not put the error message in the body of the response?
404: Route not found vs 404: User ID not found seems like it resolves all ambiguity, no?
zinekeller
on July 13, 2022
[–]
Straight answer: HTTP 2 and 3 killed that (they only send codes, not an arbitrary message)
jffry
on July 13, 2022
|
parent
|
next
[–]
In the headers, yes. But you can still put whatever you want in the response
body
alongside that 404 code in the header
quelltext
on July 13, 2022
|
parent
|
prev
[–]
They can still send bodies, which is where GP said the message should be.
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
404: Route not found vs 404: User ID not found seems like it resolves all ambiguity, no?