1.HTTP request method has the following eight kinds of methods: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, and CONNECT.
GET
GET
Request will 显示
request the specified resource. General GET
method should be used only for reading data, and should not be used to produce side effects 非幂等
operation.
GET
The method will request the specified page information, and returns the response body, GET
it is considered to be unsafe method, because GET
the method can be any access network spiders.
HEAD
HEAD
Method and GET
method, are specified resource request to the server. However, the server response HEAD
does 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. HEAD
The method is often used by the client to view server performance.
POST
POST
Submit 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. POST
The method is 非幂等
a method, since the request may create new resources and / or modify existing resources.
PUT
PUT
Requests the body to upload their content to the latest specified resource location, PUT
method 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
DELETE
Request for requesting the server to delete the requested URI
resources identified (Uniform Resource Identifier uniform resource identifier). DELETE
After the specified resource request is deleted, DELETE
the method also 幂等
is.
CONNECT
CONNECT
The method is HTTP/1.1
protocol 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
OPTIONS
Request HEAD
similar, 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 OPTIONS
request, you can test server functions are normal. JavaScript's XMLHttpRequest object CORS
when cross-domain resource sharing, is to use the OPTIONS
method to send sniffer request to determine whether there is access to the specified resource. allow
TRACE
TRACE
Echo request message requesting the server which receives the HTTP request method is mainly used for test or diagnosis.
HTTP/1.1
After increasing method
In the HTTP/1.1
following standards, and gradually expand a number of ways. Which is in use more PATCH
methods?:
PATCH
PATCH
The method appears later, in 2010, it is RFC 5789 is defined standard. PATCH
Request and PUT
the request is similar to, for updating the same resource. Both the following differences:
- But
PATCH
the general part of the resources for the update, andPUT
overall resources for the general update. - When the resource does not exist,
PATCH
it creates a new resource, andPUT
will only have to update the resource.