News for hackers. Stuff that matters.
Re:How can you not be romantic about programming? (2020) by WrtCdEvrydy on Saturday February 20, 2021 @04:52PM (#26208322)
This is a total failure to follow any sort of standard.

A 504 is a gateway timeout due to the server failing to complete the action, hell, a 400-level for "you fucked up" would be preferable.

Re:How can you not be romantic about programming? (2020) by fastball on Saturday February 20, 2021 @05:05PM (#26208420)
4xx would be what you want anyway, no?
Re:How can you not be romantic about programming? (2020) by jholman on Saturday February 20, 2021 @05:49PM (#26208745)
What you described:

  let x = 2 // runs
  x = 3;    // runs
  x = 3;    // runtime error, you made a mistake
No, I'd want a balance update to succeed. Even if it's to the same value that it already had.
Re:How can you not be romantic about programming? (2020) by wccrawford on Saturday February 20, 2021 @06:47PM (#26209271)
Or at least return a "no change" message, and not a failure result in the 400s or 500s.
Re:How can you not be romantic about programming? (2020) by fastball on Saturday February 20, 2021 @09:13PM (#26210218)
I don't think it's clear from the OC that even if they weren't using the wrong HTTP response they would want an update to succeed if it is the same value, at which point 409 could be a reasonable response code.
Re:How can you not be romantic about programming? (2020) by WrtCdEvrydy on Sunday February 21, 2021 @10:43AM (#26214257)
2XX level is for the action succeeding. 4XX level is for the action failing due to the user. 5XX level is for the action failing due to the service/code/infra.

In the real world, updating your balance to the same number should be a 200, however in some weird financial world, it may be a 400 because you may not be allowed to set the same balance due to some financial rule. A 500 is a terrible choice unless setting the balance caused an error at your code/infrastructure level.

Re:How can you not be romantic about programming? (2020) by pyrale on Saturday February 20, 2021 @07:15PM (#26209475)
304 would be fitting.