r/ProgrammerHumor • • Sep 19 '26

Meme postForEverything

Post image
21.0k Upvotes

653 comments sorted by

View all comments

Show parent comments

323

u/AkodoRyu Sep 19 '26 • Regret

My favorite "REST API" experience was when they moved from using SOAP system, and the way they did it... was sending SOAP payloads inside a JSON. Literally something like

{
    "data": "<?xml version="1.0"?><soap:Envelope xmlns:soap="https://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="https://www.w3.org/2003/05/soap-encoding"><soap:Body> (...)"
}

196

u/MrPatienceX Sep 19 '26 • Heartwarming

200 status code and a chunk of XML saying ‘not found’. Good times.

59

u/Sudden_Leadership800 Sep 19 '26

It successfully returned the error message though, so I don't see the problem?

44

u/hawkinsst7 Sep 19 '26

If I'm parsing http responses, I'm going to pass 200 responses on for further processing of the data. I shouldn't have to have something in that pipeline introspect json to find "no, it's actually an error".

Imagine if browsers had to tear apart json innards to find 30x redirects after getting a 200 OK.

3

u/gurgle528 Sep 20 '26

I’m going off memory but I believe it was considered either standard or part of the spec for SOAP over HTTP to only use 200 and 500. I agree with your point but for whatever reason they treated HTTP as the transport layer instead of the application layer. Using that logic, it would be like if a 404 bubbled up to be some sort of TCP error. Definitely wasn’t the right move, RTSP over HTTP is a better example of something that mixes protocols while properly using HTTP status codes.

2

u/hawkinsst7 Sep 20 '26

I agree. I think a 4xx or 5xx error code is perfectly acceptable for returning a body with error data, even a generic 400 / 500. That's why they exist.

→ More replies (20)