← HTTP & APIs

Software Knowledge → 03 · HTTP & APIs → Header

PART III · HTTP & APIs

Header

Extra information sent with an HTTP request or response.

01 · What is it?

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.

02 · Think of it like...

Think of it like...

Think of a package.

The package contains the main item. The label outside the package contains extra information.

HeadersInformation about the message
BodyThe main item or data

Visual: HTTP Message = Headers + Body

03 · What does it do?

What does it do?

Headers can describe:

Content TypeWhat format the body uses.
AuthenticationWho or what is allowed access.
Accepted FormatsWhat response formats the client can use.
LanguageWhich language is preferred.
CachingHow a response may be stored and reused.
Browser InformationDetails about the client software.
04 · Where is it used?

Where is it used?

Headers appear in:

HTTP Requests
HTTP Responses
API Calls
Authentication
File Downloads
Browser Communication
05 · Example

Example

Use:

Content-Type: application/json

Meaning: 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.

06 · How it connects

How it connects

Request├─ Method ├─ URL ├─ Header └─ Body
Response├─ Status Code ├─ Header └─ Body

Headers provide metadata about the HTTP message.

07 · Do Not Confuse

Do Not Confuse

Header ≠ Body

Header

Contains metadata about the message.

Body

Contains the main data being sent or returned.

Header = Information about the message
Body = Main message data
08 · Topic Glossary

Topic Glossary

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 TokenBearer TokenA 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 消息中真正携带的主要数据。
HTTPHTTP 协议The protocol that defines headers and message structure.定义 Header 和 HTTP 消息结构的通信协议。
09 · What to Remember

What to Remember

Headers contain extra information about HTTP messages.

Headers are separate from the main body.

Authentication and content type are commonly carried in headers.

HTTP Message=Headers+Body
↑