Intro
Are you still asking about difference between HTTP request method GET
and POST
in 2019? Before we dive into it, let's see and compare the difference in their properties and behaviors:
Category | GET | POST |
---|---|---|
Backward / Refresh | No harm | Data will be resubmitted (browser should warn user of resubmission) |
Bookmark | Possible | Impossible |
Encoding Type | application/x-www-form-urlencoded | application/x-www-form-urlencoded multipart/form-data |
History | Parameters stored in browser history | Parameters not stored in browser history |
URL Length | 2048 characters | Unlimited |
Data Type Restriction | ASCII only | No restriction. Allow binary data |
Security | Unsafe as data is exposed in URL | Relatively safer as parameters will not be stored in browser history or server log. |
Please note that most of the browsers comply with the HTTP standard. The table above states the behavior difference between GET
and POST
on the browser, not the intrinsic difference.
HTTP Message difference between GET and POST
Let's draw the conclusion first, there is no much difference between GET and POST. Both of them are the request method in HTTP protocol, and HTTP protocol is based on TCP/IP application layer. Hence, regardless of whether GET or POST, they both are transmitted on the same application layer abiding the same protocol, so technically speaking, there is no difference in terms of data transmission.
One might be able to spot the first and major difference on the request first line.
GET: GET /uri HTTP/1.1
POST: POST /uri HTTP/1.1
When we want to include parameters, GET
method puts parameters into URL while POST
method puts parameters into message body.
GET /url?id=1234&value=true HTTP/1.1
Host: localhost
POST /url HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
id=1234&value=true
Essentially, both GET
and POST
are transmitting with TCP connection. We can use GET
and write parameters in URL, or POST
with parameters in body, either way is fine as long as the server supports the method.
Post was published on , last updated on .
Like the content? Support the author by paypal.me!