The web HTTP messages 2 min read
What is in an HTTP request and response?
You click “View invoice.” What does your browser send, and what comes back before the page can show the invoice?
-
Read what the browser asks for
In this example, the browser sends a
GETrequest for/invoices/42. The method says what kind of operation it wants. The target names what it wants to retrieve. Headers can carry information such as accepted formats or a session cookie.In short Read the method, target, and headers to understand the request.
-
Read how the server answered
If the server returns the invoice, the response can include a
200status, aContent-Typeheader, and the invoice as the response body. The status reports the HTTP outcome, and the headers help the browser interpret the body.In short The status reports the outcome. The body carries the returned content.
Where this applies
A successful HTTP status doesn’t establish that the server returned the correct invoice. The server still has to verify which invoice the caller may read.
Keep this
Read both messages to understand one exchange.
Start with what was requested, then look at the status and the content that came back.