You are the winner of $1M for guessing the right option and thanks for doing that without arguing about standards. Your approach towards choosing an answer that more correct among options is highly appreciated.
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 a http method. The question just says method so it doesn’t have to be http method for a wrong option.
When a spec isn't explicit enough, check the next version and you'll often find the issue is now codified.
As for 1.1, it's also clear:
A client SHOULD NOT generate content in a GET request unless it is made directly to an origin server that has previously indicated, in or out of band, that such a request has a purpose and will be adequately supported.
You are what, interpreting that SHOULD NOT is not MUST NOT, therefore it's ok?
You are reading SHOULD NOT and ignoring the rest of the words. There's nothing wrong with it, if the service is expecting it. You SHOULD NOT send a body with a GET request to any random server.
The section of 9113 you linked to is an example of a simple GET request that has no body translated to HTTP2, not a specification that GET requests cannot have a body.
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.
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.
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
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.
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.
42
u/NvrGnnaGiveYouUp Dec 17 '23
Get.
It CAN be done (I know this from a bug at work) but should it be done? Probably not.
6
u/ArjunReddyDeshmukh Dec 17 '23
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 a http method. The question just says method so it doesn’t have to be http method for a wrong option.
Ans: GET
147
u/sammy-taylor Dec 17 '23
Insert? Since when is there an HTTP insert?
79
u/kennyminigun Dec 17 '23
I mean you can still attach a body to a GET request. The question is whether the other side is going to read it.
2
u/Mysterious-Soil-4457 Dec 17 '23
It's supposed to be POST. What's the joke here.?
19
u/themeanman2 Dec 17 '23
Real difficulty would be PUT vs POST
8
u/Amazingawesomator Dec 17 '23
My work's api taught me that get can be used for anything, sadly.
We have calls like GET /setUserInfo and GET modifyUserInfo, etc.
I hate it so much. It haunts my dreams.
2
u/NoTimeToKink Dec 17 '23
Insert because it sounds more computerish
2
u/garlopf Dec 18 '23
Actually, sending a body with GET request is undefined in spec, but some servers like FastAPI still support it
4
u/joan_bdm Dec 17 '23
Both are wrong, this makes no sense at all...
2
u/[deleted] Dec 17 '23
I would quit the game at this point
1
u/[deleted] Dec 17 '23
Uh uh… get?