The best HTTP methods: GET POST Comparison Tutorial In 2024, In this tutorial you can learn What is HTTP?,Two kinds of HTTP request methods: GET and POST,GET Method,POST method,Comparison GET and POST,Other HTTP request methods,
The two most common HTTP methods: GET and POST.
Hypertext Transfer Protocol (HTTP) is designed to ensure the communication between the client and the server.
HTTP is a request works between client and server - response protocol.
web browser may be the client, and network applications on the computer may also be used as the server.
Example: the client (browser) to submit an HTTP request to the server; the server returns the response to the client. The response contains status information about the request and the content may be requested.
Between the client and the server request - response to the two most commonly used methods are: GET and POST.
Please note that the query string (name / value pairs) are sent in the URL GET request:
GET requests about some of the other comments:
Please note that the query string (name / value pairs) are sent in an HTTP POST request message body of:
POST requests about some of the other comments:
The following table compares the two HTTP methods: GET and POST.
GET | POST | |
---|---|---|
后退按钮/刷新 | 无害 | 数据会被重新提交(浏览器应该告知用户数据会被重新提交)。 |
书签 | 可收藏为书签 | 不可收藏为书签 |
缓存 | 能被缓存 | 不能缓存 |
编码类型 | application/x-www-form-urlencoded | application/x-www-form-urlencoded or multipart/form-data。为二进制数据使用多重编码。 |
历史 | 参数保留在浏览器历史中。 | 参数不会保存在浏览器历史中。 |
对数据长度的限制 | 是的。当发送数据时,GET 方法向 URL 添加数据;URL 的长度是受限制的(URL 的最大长度是 2048 个字符)。 | 无限制。 |
对数据类型的限制 | 只允许 ASCII 字符。 | 没有限制。也允许二进制数据。 |
安全性 | 与 POST 相比,GET 的安全性较差,因为所发送的数据是 URL 的一部分。 在发送密码或其他敏感信息时绝不要使用 GET ! |
POST 比 GET 更安全,因为参数不会被保存在浏览器历史或 web 服务器日志中。 |
可见性 | 数据在 URL 中对所有人都是可见的。 | 数据不会显示在 URL 中。 |
The following table lists some of the other HTTP request methods:
方法 | 描述 |
---|---|
HEAD | 与 GET 相同,但只返回 HTTP 报头,不返回文档主体。 |
PUT | 上传指定的 URI 表示。 |
DELETE | 删除指定资源。 |
OPTIONS | 返回服务器支持的 HTTP 方法。 |
CONNECT | 把请求连接转换到透明的 TCP/IP 通道。 |