Several http request method

1.HTTP request method has the following eight kinds of methods: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, and CONNECT.

GET

GETRequest will 显示request the specified resource. General GETmethod should be used only for reading data, and should not be used to produce side effects 非幂等operation.

GETThe method will request the specified page information, and returns the response body, GETit is considered to be unsafe method, because GETthe method can be any access network spiders.

HEAD

HEADMethod and GETmethod, are specified resource request to the server. However, the server response HEADdoes not return the contents of part of the resource request, namely: the response body. Under such circumstances, we can not transmit the entire contents, you can get the server's response headers. HEADThe method is often used by the client to view server performance.

POST

POSTSubmit a request to the designated resource data, the server processes the request, such as: Submit form data, file upload, etc., request data is contained in the request body. POSTThe method is 非幂等a method, since the request may create new resources and / or modify existing resources.

PUT

PUTRequests the body to upload their content to the latest specified resource location, PUTmethod is 幂等the method. The latest resource data transfer specified by this method the client to the server can replace the contents of the specified resource.

DELETE

DELETERequest for requesting the server to delete the requested URIresources identified (Uniform Resource Identifier uniform resource identifier). DELETEAfter the specified resource request is deleted, DELETEthe method also 幂等is.

CONNECT

CONNECTThe method is HTTP/1.1protocol reserved, the proxy server can be connected to the pipeline mode. Commonly used in SSL communication link and the non-encrypted encrypted HTTP proxy server.

OPTIONS

OPTIONSRequest HEADsimilar, it is generally used by the client to view server performance. This method will return all HTTP requests that the server supports the requested resource method will use '*' instead of the resource name, the server sends a OPTIONSrequest, you can test server functions are normal. JavaScript's XMLHttpRequest object CORSwhen cross-domain resource sharing, is to use the OPTIONSmethod to send sniffer request to determine whether there is access to the specified resource. allow

TRACE

TRACEEcho request message requesting the server which receives the HTTP request method is mainly used for test or diagnosis.

HTTP/1.1After increasing method

In the HTTP/1.1following standards, and gradually expand a number of ways. Which is in use more  PATCHmethods?:

PATCH

PATCHThe method appears later, in 2010, it is RFC 5789 is defined standard. PATCHRequest and PUTthe request is similar to, for updating the same resource. Both the following differences:

  • But PATCHthe general part of the resources for the update, and PUToverall resources for the general update.
  • When the resource does not exist, PATCHit creates a new resource, and PUTwill only have to update the resource.

Guess you like

Origin www.cnblogs.com/tzxy/p/11345892.html