What is a HTTP request an how does it look like?
Experience Level: Junior
Tags: HTTP protocolQuality Assurance (QA)
Answer
The HTTP request is the message that is sent from the browser to the web server. The web server accepts the request and responds with the response.
The HTTP request contains the following:
- Address
- URL address of the document (web page) that is to be downloaded
- Method
- Version of HTTP protocol to be used for the communication
- Headers (cookies, authentication, compression, browser identifier ...)
- Body with data
GET / HTTP/1.1
Host: www.bettercoder.io
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: _ga=GA1.2.329801189.1515987465; ai_user=4mHmF|2018-02-18T23:24:12.252Z;
Related Protocols job interview questions
What happens behind-the-scenes if you enter a URL address to the browser address bar and hit enter?
HTTP protocolQuality Assurance (QA) JuniorWhat is a HTTP response?
HTTP protocolQuality Assurance (QA) JuniorWhat are HTTP headers good for? Where can you see HTTP headers? What HTTP headers do you know?
HTTP protocolQuality Assurance (QA) MediorWhat HTTP methods do you know and what are they good for? Where can you see the HTTP method?
HTTP protocolQuality Assurance (QA) MediorWhat HTTP status codes do you know and what are they good for? Where can you see the HTTP status code?
HTTP protocolQuality Assurance (QA) Medior