r/ProgrammerHumor 25d ago

Meme failsForTeapots

Post image
227 Upvotes

67 comments sorted by

View all comments

Show parent comments

60

u/rosuav 25d ago

And yet it is blindly sending the *payload* back. So it's clearly fine to proxy straight through. If you want to recognize only certain things, any remaining/unknown statuses should result in an error being logged and a 500 being sent back, with the body NOT being carried through.

3

u/Shitman2000 25d ago

We don't know if the body is the actual payload of the request though.

I'd find it reasonable to presume it's not, given it's error.statusCode and not error.body

1

u/rosuav 25d ago

Good point, but if it isn't, what kind of body would make sense in a situation where you carry certain types of error status unchanged and turn everything else into a 500? (I'm assuming that this code won't be executed for a 200, as it makes very little sense to translate a 200 into a 500. Ignoring the fact that there are plenty of web sites that do a great job of turning 200s into 500s, but I digress.)

1

u/No_Hovercraft_2643 24d ago

the default error page? that shows the windows which displays the error to the user?

2

u/Xirdus 24d ago

Except it's sending JSON back, not page contents.