HTTP Request Methods
HTTP request methods define the communication method between the client and the server.
According to the HTTP standard, HTTP requests can use multiple request methods.
The following is a list of common HTTP request methods:
| Serial No. | Method | Description |
|---|---|---|
| 1 | GET | Retrieve resources from the server. Used to request data without modifying it. For example, fetching web pages, images, etc. from the server. |
| 2 | POST | Send data to the server to create a new resource. Commonly used for submitting form data or uploading files. The sent data is included in the request body. |
| 3 | PUT | Send data to the server to update an existing resource. If the resource does not exist, create a new one. Unlike POST, PUT is usually idempotent, meaning that executing the same PUT request multiple times will not produce different results. |
| 4 | DELETE | Delete the specified resource from the server. The request contains the identifier of the resource to be deleted. |
| 5 | PATCH | Perform a partial modification to a resource. Similar to PUT, but PATCH only changes part of the data rather than replacing the entire resource. |
| 6 | HEAD | Similar to GET, but the server only returns the response headers, not the actual data. Used to check resource metadata (e.g., check whether a resource exists, view response header information). |
| 7 | OPTIONS | Returns the HTTP methods supported by the server. Used to check which request methods the server supports, typically for preflight requests in Cross-Origin Resource Sharing (CORS). |
| 8 | TRACE | Echoes the request received by the server, mainly for diagnostics. The client can view the processing path of the request on the server. |
| 9 | CONNECT | Establishes a tunnel to the server, usually used for HTTPS connections. The client can send encrypted data through this tunnel. |
Request Methods Defined by Each Version
HTTP/1.0
HTTP/1.0 defined the following three request methods:
- GET- Request the specified resource.
- POST- Submit data to process the request.
- HEAD- Request the response header information of the resource.
HTTP/1.1
HTTP/1.1 introduced more methods:
- GET- Request the specified resource.
- POST- Submit data to process the request.
- HEAD- Request the response header information of the resource.
- PUT- Upload files or update resources.
- DELETE- Delete the specified resource.
- OPTIONS- Request to obtain the request methods supported by the server.
- TRACE- Echo the request received by the server, mainly for diagnostics.
- CONNECT- Establish a tunnel for communication with the proxy server, usually used for HTTPS.
HTTP/2
HTTP/2 basically follows the methods of HTTP/1.1, but optimizes the protocol to improve transmission efficiency and speed. HTTP/2 also introduces new features such as multiplexing, header compression, and server push.
HTTP/3
HTTP/3 is implemented based on the QUIC protocol and continues to use HTTP/2 methods. HTTP/3 mainly improves the transport layer, using UDP instead of TCP to increase transmission speed and reliability.
Other Extensions