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 | |
Headers | key: value pairs, send additional information to the server | |
Body | The body is optional and contains data, such as parameters. GET requests usually do not have a body, so they are left blank. |
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