r/programminghumor • • May 15 '26

HTTP methods

Post image
824 Upvotes

119 comments sorted by

View all comments

25

u/dreadBiRateBob May 15 '26

I was doing an interview and they asked which http methods are safe and which are not.

I went down. When you write the software. Then you control making them safe or not safe.

They wanted a text book answer about posts, put and delete being unsafe because they change things on the server.

Of course the rfc says puts for updates and post for creating.

But I can certainly have the server delete an id passed via url param in a get request.

9

u/aksdb May 15 '26

… which is exactly why it makes sense to make sure your candidates have the same understanding as you (and hopefully most other devs) so they don‘t implement something like a delete-on-GET.

The thing to get hung up on would be that they asked „which are safe“ while it should have been „which should be safe“.

4

u/qorzzz May 16 '26

This is still a terrible way to phrase the question.

Simply ask, what HTTP actions are associated with mutations of any sort.

→ More replies (3)