← Learn

HTTP FIELD GUIDE

HTTP headers and request bodies

Learn how headers describe a request and how to choose a body format.

What do headers do?

Headers carry metadata about a request or response. Accept describes which response formats the client can handle. Content-Type describes the format of the body being sent. They answer different questions: asking for JSON does not automatically turn a text body into JSON.

Choose a body format

Use application/json for JSON data and validate its syntax before sending. Use application/x-www-form-urlencoded for simple key-value form data. A raw text body is useful when the API expects plain text. Follow the target API documentation rather than guessing based on a successful status code.

What can a browser send?

A web page cannot directly set every header. The browser controls fields such as Host, Content-Length and Cookie, and cross-origin custom headers may trigger a CORS preflight. In this tool, GET and HEAD have no request body. If a copied cURL command includes browser-controlled headers, remove them or run the command in a terminal.

References