Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP: GET请求和POST请求的区别 #63

Open
leslie1943 opened this issue Nov 24, 2020 · 0 comments
Open

HTTP: GET请求和POST请求的区别 #63

leslie1943 opened this issue Nov 24, 2020 · 0 comments

Comments

@leslie1943
Copy link
Owner

标准答案

  • GET 在浏览器回退时是无害的,而 POST 会再次提交请求
  • GET 产生的 URL 地址可以被 Bookmark,而 POST 不可以
  • GET 请求会被浏览器主动 cache, 而 POST不会, 除非手动设置
  • GET 请求只能进行 URL 编码, 而POST支持多种编码
  • GET 请求参数会被完整保存在浏览器历史记录里, 而POST中的参数不会保留
  • GET 请求在 URL 传送的参数是有长度限制的, 而 POST 没有
  • GETPOST 更不安全, 因为参数直接暴露在 URL 上, 不能传递敏感信息
  • GET 参数通过 URL 传递, POST放在 Request body

加强版

  • GET 会产生一个TCP数据包: 浏览器会把http headerdata一并发送出去,服务器响应200(返回数据)
  • POST 产生两个TCP数据包, 浏览器先发送 header, 服务器响应 100 continue, 浏览器再发送请求, 服务器响应200(返回数据)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant