The difference between Post and Get requests

The difference between Post and Get requests


I. Introduction

  • Personal homepage : ζ小菜鸡
  • Hello everyone, I am a newbie. Let us learn the difference between Post and Get requests.
  • If the article is helpful to you, welcome to follow, like, and collect (three consecutive clicks)

2. The difference between Post and Get requests

  • Parameter passing method (get request parameters are passed through the url, and post requests are passed in the request body)
    • Get request will append the parameters to the URL, use? Cutting, & connection failure parameters, obtaining resources (requesting data from the service).
    • The Post request will place the parameters in the http request body, and Post will send the request data (submit data to the server).
  • Response mode (Get generates one tcp data packet, post generates two tcp data packets)
    • In a Get request, the browser will send the http header and data together, and the server will return a 200 response code. The data passed can only be key-value pairs, and other types of data cannot be passed.
    • Post request first sends header to the server, the server responds with 100 (continue), and then sends data. The server returns a 200 response code, so it supports the transmission of large amounts and multiple types of data.
  • The amount of data
    • Get request, get request has URL length limit, http protocol itself has no limit, request length limit is determined and set by the browser and web server
    • Post request, transmitting a large amount of data
  • safety
    • Get request, the get request is a static resource, and the parameters will be cached as part of the URL. If they are data, they will not be cached.
    • Post requests will not be used as part of the URL, will not be cached, and will not be saved in server logs or browser browsing records.

Guess you like

Origin blog.csdn.net/weixin_45191386/article/details/133250111