GET vs POST
In this lesson, we'll compare and contrast GET and POST requests.
We'll cover the following...
As we’ve seen earlier, an HTTP request starts with a peculiar start line:
GET / HTTP/1.1
First and foremost, a client tells the server what verbs it is using to perform the request. Common HTTP verbs include GET
, POST
, PUT
, and DELETE
, but the list could go on with less common verbs like TRACE
, OPTIONS
, or HEAD
.
In theory, no method is safer than others; in practice, it’s not that simple.
GET
requests usually don’t carry a body, so parameters are included in the URL (i.e., www.example.com/articles?article_id=1
) whereas POST
requests are generally used to send (“post”) data which is included in the body. Another difference is in the side effects that these verbs carry with them. GET
is an idempotent verb, meaning no ...