Charles, empty request body with non-empty response body
I am confused about this as how am I seeing a response without sending a request?
A request consists of a few things:
- Always: an HTTP method (GET, POST, or similar)
- Always: a path (/document/123)
- Optional: any number of HTTP headers (my-header: abc)
- Optional: a request body
A response consists of:
- Always: an HTTP status (404)
- Always (in HTTP/1): an HTTP status message (Not Found)
- Optional: any number of HTTP headers (my-header: abc)
- Optional: a response body
In your case, you are sending a request, it's just that your request only contains a method, URL and headers, but no body. That's totally normal and this is very common for most HTTP requests.
The request and response body are totally independent: it's fine for neither to have a body, or for just one (either one) to have a body, or for both to have a body.
As an example, a GET request to https://google.com/search from a browser will include a method (GET) and a path (/search) and a selection of headers from the browser (such as a user-agent), but won't include any body, and the response will have a status (200) and message (OK), headers about the response data (e.g. content-length: ...) and the body will be the HTML for the google search page.