Request/response structure
HTTP messages carry headers and an optional body.
What it is
HTTP messages carry headers and an optional body.
When to use it
Understand transport independently of framework helpers.
Syntax
METHOD /path HTTP/1.1
Header: value
bodyExample
POST /orders HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: application/json
{"reference":"ORD-42","total_cents":1250}
HTTP/1.1 201 Created
Content-Type: application/json
{"id":42}Common mistakes
Content-Type describes the sent body; Accept requests the response format; never put credentials in URLs.