Which list contains the main parts of an HTTP request?
Options
- Method, URL, headers, optional body (Correct option)
- Port, cookie, password, session id
- HTML, CSS, JavaScript and images
- Status code, reason phrase and body only
Answer
Method, URL, headers, optional body
Why
An HTTP request has:
- Method: what to do (GET, POST, PUT, PATCH, DELETE).
- URL: which resource (
/users/42). - Headers: extra information (
Authorization,Content-Type). - Body (optional): data you send, usually JSON, for POST/PUT/PATCH.
The RESPONSE has a status code, headers and a body.
Remember
Request = method + URL + headers + body.