0

Background:

Looking at some links like these below, I noticed two unique sets of descriptions for GET versus POST.

  1. One description states that the difference is in how the information is sent: GET sends that information through the URL whereas POST sends that information through the HTTP request body.
  2. Another description states that the difference is in which way that information is sent: GET sends information to the server whereas POST requests information from the server.

I find these descriptions to be lacking for the following reasons:

  • What if I want to get something from the server (GET) but I am sending a large amount of data first (eg. 50MB of text) so I would need to send it in the HTTP request body (POST). Would it be OK to use POST to get something from the server?
  • What if I don't want sensitive information to be stored in the URL, is it OK to instead use POST everytime?
  • The jquery GET function has the same method signature as the jquery POST function (see documentation), specifically it can also send data as A plain object or string that is sent to the server with the request, which I interpret as being added to the HTTP request body. If data for GET can be sent via the HTTP request body, then to me, this contradicts most of these sites that claim that as one of the differentiating descriptions of POST vs GET.
  • Nothing's to stop me from creating API endpoints which are GET but behave like POST (or PUT, or DELETE or PATCH)

Question:

Is the lack of strict descriptions because of my poor understanding, because of the ad hoc development process for HTTP/Ajax or is it something else entirely?

Supporting Links:

puk
  • 16,318
  • 29
  • 119
  • 199
  • 1
    There isn't a "lack of strict descriptions". The strict description is given in the [HTTP standard](https://tools.ietf.org/html/rfc7231#section-4.3). The sections on `GET` and `POST` are quite short and readable, so I recommend you start there. – Kevin Christopher Henry Jan 30 '21 at 21:22
  • In simple terms: GET simple just reading something straightforward, PUT for something that require more time. – Rafael Valero Jan 30 '21 at 21:26
  • @RafaelValero maybe I didn't explain well enough, if you read the comments here you will get my point: What does one do if they need to implement a GET but with thousands of parameters (eg. complex search queries)? https://stackoverflow.com/a/2659995/654789 – puk Feb 01 '21 at 19:07

0 Answers0