

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 6
click for more info
Not enough gems
Cost: 6 gems
1: What Are HTTP Headers?
incomplete
2: Using the Browser's Developer Tools
incomplete
3: Why Are Headers Useful?
incomplete
4: Network Tab Practice
incomplete
This lesson's interactive features are locked, please to keep using them
An HTTP header allows clients and servers to pass additional information with each request or response. Headers are just case-insensitive key-value pairs that pass additional metadata about the request or response.
HTTP requests from a web browser automatically carry with them many headers, including but not limited to:
As developers, we can also define custom headers in each request.
The Headers API allows us to perform various actions on our request and response headers such as retrieving, setting, and removing them. We can access the headers object through the Request.headers and Response.headers properties.
Complete the getContentType() function. It takes a response object as input and should return the Content-Type.
Take a look at the test suite to see exactly how it's being created.
Use the .get() method on the response object's headers property to get access to the header you need.
The return type is string but .get() will return null if the header doesn't exist. Make sure a string is returned.