

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
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.
In Python's HTTP libraries, headers are typically represented as dictionaries. When using PyFetch, we can access response headers through the headers property of the response object.
Complete the get_content_type(resp: HeaderResponse) -> str 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 dictionary .get() method on the response object's headers property to get access to the header you need.
Make sure to return an empty string if the header doesn't exist.