What is HTTP ?
๐ The Hypertext Transfer Protocol (HTTP) is designed in such a way that it can create a communication between between clients and servers.
๐ HTTP works as a request-response protocol between clients and servers and follows the old classical client-server model.
Request-Response Overview
๐ The client (browser) sends a HTTP request to the server. Then the server returns a response to the client.
Get()
๐ Get method is used to get data from a specific server using a URL.
๐ It is only used to request and retrieve data from a specific resource
Get /index.html
Post()
๐ Post method is used to send data to a server for creation/updating of a resource
๐ The data sent to the server with post method is stored in the request body of the HTTP request
POST /test HTTP/1.1
Host: foo.example
Content-Type: application/x-www-form-urlencoded
Content-Length: 27
field1=value1&field2=value2
Put()
๐ Post method is also used to send data to a server for creation/updating of a resource
๐ Difference between Put and Post method is Put requests are idempotent, that is invoking the same Put request would always produce the same result.
๐ But Successive Identical Post would have additional side effects to the server.
PUT /new.html HTTP/1.1
Host: example.com
Content-type: text/html
Content-length: 16
<p>New File</p>
Head()
๐ Head is almost similar to Get method, but it does not have any response body unlike Get method.
๐ Head method is used to check the Get method response before making the actual Get request.
HEAD /index.html
Delete()
๐ The HTTP Delete method is used to delete a specified resource
DELETE /file.html HTTP/1.1
Patch()
๐ The HTTP Patch request method is a set of instructions which is used for partial modification of a specific resource.
๐ Unlike Put methods, the Patch request method may or may not be idempotent.
๐ It may produce side effects to the server.
PATCH /file.txt HTTP/1.1
Options()
๐ The Options request method mainly provides communication options for a specific resource
๐ A client can specify a URL or an asterisk (*) with this method to refer to the entire server.
OPTIONS /index.html HTTP/1.1
OPTIONS * HTTP/1.1
Connect()
๐ The Connect method is used to start a two-way communication tunnel with the requested resource.
๐ The Client asks the HTTP server to tunnel the TCP Connection to the desired destination.
CONNECT www.example.com:443 HTTP/1.1
Trace()
๐ The Trace method is used to perform a message loop-back test which test the path of the target resource.
๐ It also provides a useful debugging mechanism.
TRACE /index.html
If you liked my content, connect with me? ๐