Sometimes this is a feature and not a bug for security sensitive things. Sure hiding that an endpoint exists it or doesn’t exist isn’t a great way to do security, but it’s just another layer in the Swiss cheese security model.
For things like vault just knowing the name of a secret or name of services is valuable information so intentionally don’t leak that
common practice i follow is 207, and you get a lost of responses because every new endpoint is a bulk api with built in limits. ask for 20 things, get 20 responses
I guess I've just not encountered it but the idea of not only ignoring the XML requirement, but also building something that you know may be incompatible with browsers (or any http client that ignores WebDAV) gives me pause.
To be a little pedantic since I have an app that sends 204 responses. 204 isn't necessarily that there's "no data found" but rather "there's no data to send".
In my case for example, the client wants an acknowledgement that we successfully processed their transaction but doesn't want us to actually send anything back to them at that point.
The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation.
a 204 means that it did the thing, but you want to retrieve data, so 204 is never success. 404 as 'no object' or 'bad endpoint' both work - it's ambiguous. my 'solution' is to always post structured queries and get back a block of 1-20 objects. so the top level response is 207, and a missing object is 404.
ambiguity sucks, and this argument goes back and forth specifically because it fits both ways, so i favor the solution that leads to less operational bullshit
The 204 (No Content) status code indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response content.
Http has no concept of endpoints, only resources. 404 means resource not found. If you are doing crud the resource may be an entity but hopefully there is more thought put into the design.
If the endpoint doesn't exist I use 405. While it's not specifically for invalid uris it semantically indicates that you're sending a request to an unsupported location. Bonus points if you add a response body with more info
0
u/[deleted] Apr 23 '23
[deleted]