What is it?
An HTTP header carries additional information about a request or response.
Headers describe how the message should be handled or interpreted.
Simple Definition: Headers are extra information attached to an HTTP message.
Software Knowledge → 03 · HTTP & APIs → Header
Extra information sent with an HTTP request or response.
An HTTP header carries additional information about a request or response.
Headers describe how the message should be handled or interpreted.
Simple Definition: Headers are extra information attached to an HTTP message.
Think of a package.
The package contains the main item. The label outside the package contains extra information.
Visual: HTTP Message = Headers + Body
Headers can describe:
Headers appear in:
Use:
Content-Type: application/jsonMeaning: The message body contains JSON.
Second example:
Authorization: Bearer <token>Meaning: The request includes authentication information. The token shown here is only a placeholder, not a real token.
Headers provide metadata about the HTTP message.
Header ≠ Body
Contains metadata about the message.
Contains the main data being sent or returned.
| ENGLISH TERM | 中文 | SIMPLE ENGLISH | 中文小白理解 |
|---|---|---|---|
| Header | 请求头 / 响应头 | Extra information attached to an HTTP message. | 随 HTTP 请求或响应一起发送的附加信息。 |
| Request Header | 请求头 | Header information sent by the client. | 客户端随请求一起发送的附加信息。 |
| Response Header | 响应头 | Header information returned by the server. | 服务器随响应一起返回的附加信息。 |
| Content-Type | 内容类型 | A header that describes the format of the message body. | 用来说明请求体或响应体是什么数据格式的 Header。 |
| Authorization | 授权信息 | A header commonly used to send authentication credentials. | 常用来携带身份认证或访问凭证的 Header。 |
| Bearer Token | Bearer Token | A token commonly sent in an Authorization header. | 常通过 Authorization Header 发送的一种访问 Token。 |
| Metadata | 元数据 | Information that describes other data. | 用来说明另一份数据属性的信息。 |
| Body | 请求体 / 响应体 | The main data inside an HTTP message. | HTTP 消息中真正携带的主要数据。 |
| HTTP | HTTP 协议 | The protocol that defines headers and message structure. | 定义 Header 和 HTTP 消息结构的通信协议。 |
Headers contain extra information about HTTP messages.
Headers are separate from the main body.
Authentication and content type are commonly carried in headers.