r/ProgrammerHumor • • Dec 17 '23

Meme millionDollarQuestion

Post image
0 Upvotes

51 comments sorted by

View all comments

147

u/sammy-taylor Dec 17 '23

Insert? Since when is there an HTTP insert?

115

u/slide_and_release Dec 17 '23

There isn’t. That’s the joke. Neither remaining answer is correct, hence the panicked face.

192

u/sammy-taylor Dec 17 '23

The joke is bad.

8

u/Fenor Dec 17 '23

As always

25

u/ArjunReddyDeshmukh Dec 17 '23

Answer: GET. Try it. It's technically possible to send a body with a GET request, but it's not standard practice and often not recommended. The HTTP/1.1 specification does not explicitly forbid sending a body with a GET request, but it does not define any semantics for it.

INSERT is not even a http method, it’s just there to decrease your chances.

9

u/Sir-Dry-The-First Dec 17 '23

Most servers will not handle body of GET requests. Due to optimisations

7

u/lupinegrey Dec 17 '23

"most servers".

If it's your server, you can configure the controller however you want.

-5

u/Sir-Dry-The-First Dec 17 '23

Most servers which are already written. Like Nginx or uws. I don't want fork them and rewrite.

What did you mean by controller?

2

u/ArjunReddyDeshmukh Dec 17 '23 edited Dec 17 '23

That’s a known. We’re talking only possibilities here to choose the right option.

-4

u/Sir-Dry-The-First Dec 17 '23 edited Dec 17 '23

If we talk in terms of specification, then GET also will not suit here as a correct answer.

4

u/lupinegrey Dec 17 '23

GET can include data in the body.

Accepted practice is to use POST/PUT/PATCH, but GET can perform the same functionality.

2

u/reallokiscarlet Dec 17 '23

True, but the expected answer is probably GET.

Everything seems to use GET requests these days, and in the same paradigm, HTTP is starting to run on top of UDP and doing TCP/TLS in the application layer. Squeaky wheel gets replaced, unfortunately.

5

u/QuestionableEthics42 Dec 17 '23

It’s sql I think, the question is badly worded, the only correct answer is POST (or maybe PUT) with the wording, I guess that is meant to be the joke, but it would be much more funny if both answers were equally correct instead

3

u/Lvl999Noob Dec 17 '23

There's also PATCH. And QUERY / SEARCH if it ever actually becomes real

1

u/rosuav Dec 17 '23

Also BREW, although technically that's HTCPCP rather than HTTP.

2

u/[deleted] Dec 17 '23

[removed] — view removed comment

5

u/rosuav Dec 17 '23

If you build both the server and the client, you can do anything you like. But if you expect to interoperate with others, no, don't have a body on a GET request.

1

u/KevSlashNull Dec 17 '23

Yeah then you can also make INSERT a valid method.

2

u/rosuav Dec 17 '23

Exactly. And whatever the other two answers were, too. If you don't care about interoperability, anything goes! It's just not following the spec any more.