Parse an HTTP Exchange
HTTP is a text-based protocol where each message starts with a request/status line, followed by headers (key-value pairs), a blank line, and an optional body.
Request Format
METHOD /path HTTP/1.1
Header-Name: value
[body]Response Format
HTTP/1.1 STATUS_CODE REASON_PHRASE
Header-Name: value
[body]Key Fields to Identify
- Method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
- Status code: 2xx (success), 3xx (redirect), 4xx (client error), 5xx (server error)
- Headers: Content-Type, Content-Length, Host, Cache-Control, Set-Cookie
- Body: The payload (for POST/PUT requests) or response content