Get post difference

Time:2019-12-6

Get post difference

  • In general, get is used to read resources from the server, and post is used to upload data to the server, such as uploading forms
  • Get usually uses the URL to deliver messages to the server. The URL length is generally limited by browsers, intermediate nodes, servers, etc. post can deliver data through the body
  • In general, these nodes in the middle record URL logs, but the body records very little
  • The resource obtained through get can be cached, because the result of multiple requests is the same, post is not idempotent, and cannot be executed at will multiple times, and cannot be cached. When refreshing the browser, you will be informed whether to submit the order repeatedly
  • However, as long as the client and server reach a consensus, the server can also accept the get request of the client to carry the body
  • When implementing Ajax or restful interface, you can define the use of post to do get. Get can also carry JSON body (but in restful, you don’t usually carry body in get). As long as the CS parties agree, you can
  • Security. Just mentioned that post is a little safer than get, but it can be ignored. As long as you use clear text HTTP, it is not safe

Reference material

  • What’s the difference between get and post?