News for hackers. Stuff that matters.
Re:Surprising things about HTTP by yellow_lead on Thursday June 09, 2022 @06:56AM (#31679693)
> Others, like 409 Conflict have such a narrow use-case that I’ve never seen it used in practice.

Huh, I've often seen this used to prevent resources with unique names or ids from being created. i.e POST

/things

{ "name" : "myUniqueName" }

Re:Surprising things about HTTP by ReactiveJelly on Thursday June 09, 2022 @08:18AM (#31680253)
I actually have a CRUD-type interface for a database, where everything is done with GET and POST (or PUT or whatever), and I use 409 Conflict to mean "There was a conflict, someone else edited this, I rejected your edit because your edit was based on an assumption that is no longer true".

I guess if I used AJAX for everything, I could return a 200 OK and a JSON object meaning "actually everything is not okay, there was a conflict" but I did it the simple way first.

Re:Surprising things about HTTP by heretogetout on Thursday June 09, 2022 @08:39AM (#31680448)
I've seen 412 "precondition failed" returned when there is that sort of conflict. For example, Google Cloud Storage returns 412 if you try to replace exactly one resource (defined as data + generation or etag) with new data: https://cloud.google.com/storage/docs/request-preconditions
Re:Surprising things about HTTP by lucakiebel on Thursday June 09, 2022 @07:46AM (#31680004)
Yeah, like >>409 an account with this email already exists<<
Re:Surprising things about HTTP by drewcoo on Thursday June 09, 2022 @10:18AM (#31681467)
That usage that leaks sensitive information.
Re:Surprising things about HTTP by kevincox on Thursday June 09, 2022 @12:55PM (#31683644)
Not leaking this sensitive information is almost always done because doing otherwise would create very confusing UX.