Web browsers make HTTP requests to request data from a web server.

Parts of an HTTP Request:

Parts of an HTTP Request

Name Description Example
Request Line Contains Method Type, file path, the protocol, and the protocol version
GET /courses HTTP/1.1
HTTP Request Line

 

Headers key: value pairs, send additional information to the server
Content-Type: text/html; charset=UTF-8
Host address: edu.lampp.org
Content-length: 2865
HTTP Request Header

 

Body The body is optional and contains data, such as parameters. GET requests usually do not have a body, so they are left blank.
  
HTTP Request Line

 

Different types of HTTP Requests use different methods.  

GET: A request to fetch web data.

POST: A request to update or create data

PUT:  It is used to update or create a resource, but unlike POST it is idempotent

HEAD:  Similar to GET, but it is asking for the response without the response body (the data)

CONNECT:  Connect is used to create a tunnel connection with a server

DELETE: deletes the specified resource Opening two-way communication with the requested resource

OPTIONS: request the permitted  request options