Headers Flashcards

1
Q

What are headers?

A

They’re like metadata tags that get sent along with HTTP requests and responses.

They provide information about the data being transferred, how to handle it, and various control parameters for the communication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the Content-Type header for?

A

Tells the receiver what kind of data is being sent: text/html, aplication/json, image/jpeg, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the Authorization header for?

A

Used to sent credentials and tokens for authentication. It often starts with Basic or Bearer, followed by the authentication token.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the Accept header for?

A

Indicates what types of content the client can understand. For example, a browser might send “Accept: text/html,application/json” to say it can handle both HTML and JSON responses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the Cache-Control header for?

A

Defines caching policies like how long to store the response, whether to use cached version, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the Origin header used for?

A

Indicates where the request originated from, use in cross-origin resource sharing to help prevent unauthorized access from different domains.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the User-Agent header for?

A

Identifies the client making the request, typically including information about the browser and operating system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the Cookie header for?

A

Contains stored session information and user preferences that the browser sends to the server with each request.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly