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.