Ruby HTTP request response - 1
At the end browser talks in the language of HTTP request. But we really know minimal about it.
The request process flow is as simple as browser sends http request to the server and receives a response. Sometimes what we see is a combined result of responses from multiple requests.
To summarize every image, text or anything seen on browser is a response received to an http request.
Let’s see what a request and response headers of http request consists of.
HTTP request headers can be broadly divided into 3 parts -
- Response Headers
- Request Headers
Sample HTTP request format
"GET /blog HTTP/1.1"
Let’s divide it into sections and see what each one means
GET is a method used in http request which indicates type of work expected from request. There are methods like
POST, DELETE, PUT, PATCH.
It tells at what url should server look for. e.g.
HTTP protocol version as 1.1 or 2.0
- Status Code
It is a 3 digit code that represents response from server. Like
Status Code: 304