About
An HTTP request is a message sent from a client to a server.
It's the first part of a fetch, the second being the response.
Structure
A request message has:
- a first line called the request line that includes:
- the method that the server should execute for the client.
- the request URI which may have one of the the following values:
- the URI that defines where the request should be send.
- or * for a options request.
- and the http version
- and an optional body
method url httpVersion
headerName: headerValue
...
headerNameN: headerValueM
Optional Body
...
Example with a get request
GET https://datacadamia.com/web/http/method HTTP/1.1
Host: datacadamia.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: https://datacadamia.com/web/http/method
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nl;q=0.8,fr;q=0.7
Cookie: Session=2he81i5j7tvd5
Header
List non-exhaustive of headers put on the request
- What is the HTTP Host Header and how it is used? - the destination network location
Host: datacadamia.com
- HTTP Connection management - the control of the TCP conenction
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: https://datacadamia.com/web/http/method
Cookie: name=value; _name=value1
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nl;q=0.8,fr;q=0.7
Security Type
Same / Cross Origin
When the origin of the resource that created the request:
- is not the same than the request origin, the request is called a cross-origin request
- is the same than the request origin, the request is called a same-origin request
Same / Cross Site
Functional Type
Management
Visualization
Drawing:
Modelisation:
Capture
Create
Save
You can save request in a har format.
Example in Chrome: