News for hackers. Stuff that matters.
Re:How to (and how not to) design REST APIs by DaiPlusPlus on Wednesday November 22, 2023 @08:54PM (#38388213)
But HTTP 204 is also appropriate for a some POST requests where a response is unnecessary or sometimes not even possible (e.g. browser-based "beacon" requests during onunload[1]), so if you use 204 to represent entity-does-not-exist then you need to re-think how to handle no-response-responses.

As an alternative to using HTTP 404 for detecting a misconfigured server with bad routing, you could use the "Server" response header to include an invariant indicator as a confidence sign to the client that the HTTP 404 response does not mean bad-routing or misconfigured server - or expired-domain-name-now-points-to-a-domain-squatting-website.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Navigator/s...

There are no comments on this comment yet.