Register to Better Coder! It's free.
Enjoy the premium features and succeed at every job interview.

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;

Comments

No Comments Yet.
Be the first to tell us what you think.
HTTP protocol for beginners
HTTP protocol for beginners

Are you learning Protocols ? Try our test we designed to help you progress faster.

Test yourself