ieving, setting, adding to, and removing headers from the list of
the request's headers.

A ` Headers ` object has an associated header list, which is initially empty
and consists of zero or more name and value pairs. You can add to this using
methods like [ ` append() ` ](/en-US/docs/Web/API/Headers/append "append\(\)")
(see  Examples  .) In all methods of this interface, header names are matched
by case-insensitive byte sequence.

For security reasons, some headers can only be controlled by the user agent.
These headers include the [ forbidden header names ](/en-
US/docs/Glossary/Forbidden_header_name) and [ forbidden response header names
](/en-US/docs/Glossary/Forbidden_response_header_name) .

A Headers object also has an associated guard, which takes a value of `
immutable ` , ` request ` , ` request-no-cors ` , ` response ` , or ` none ` .
This affects whether the [ ` set() ` ](/en-US/docs/Web/API/Headers/set
"set\(\)") , [ ` delete() ` ](/en-US/docs/Web/API/Headers/delete "delete\(\)")
, and [ ` append() ` ](/en-US/docs/Web/API/Headers/append "append\(\)")
methods will mutate the header. For more information see [ Guard ](/en-
US/docs/Glossary/Guard) .

You can retrieve a ` Headers ` object via the [ ` Request.headers ` ](/en-
US/docs/Web/API/Request/headers) and [ ` Response.headers ` ](/en-
US/docs/Web/API/Response/headers) properties, and create a new ` Headers `
object using the [ ` Headers() ` ](/en-US/docs/Web/API/Headers/Headers
"Headers\(\)") constructor.

An object implementing ` Headers ` can directly be used in a [ ` for...of `
](/en-US/docs/Web/JavaScript/Reference/Statements/for...of) structure, instead
of [ ` entries() ` ](/en-US/docs/Web/API/Headers/entries "entries\(\)") : `
for (const p of myHeaders) ` is equivalent to ` for (const p of
myHeaders.entries()) ` .

**Note:** you can find out more about the available headers by reading our [
HTTP headers ](/en-US/docs/Web/HTTP/Headers) reference.

##  Constructor

[ ` Headers() ` ](/en-US/docs/Web/API/Headers/Headers "Headers\(\)")

    

Creates a new ` Headers ` object.

##  Instance methods

[ ` Headers.append() ` ](/en-US/docs/Web/API/Headers/append)

    

Appends a new value onto an existing header inside a ` Headers ` object, or
adds the header if it does not already exist.

[ ` Headers.delete() ` ](/en-US/docs/Web/API/Headers/delete)

    

Deletes a header from a ` Headers ` object.

[ ` Headers.entries() ` ](/en-US/docs/Web/API/Headers/entries)

    

Returns an [ ` iterator ` ](/en-
US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through
all key/value pairs contained in this object.

[ ` Headers.forEach() ` ](/en-US/docs/Web/API/Headers/forEach)

    

Executes a provided function once for each key/value pair in this ` Headers `
object.

[ ` Headers.get() ` ](/en-US/docs/Web/API/Headers/get)

    

Returns a [ ` String ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/String) sequence of all the
values of a header within a ` Headers ` object with a given name.

[ ` Headers.getSetCookie() ` ](/en-US/docs/Web/API/Headers/getSetCookie)

    

Returns an array containing the values of all [ ` Set-Cookie ` ](/en-
US/docs/Web/HTTP/Headers/Set-Cookie) headers associated with a response.

[ ` Headers.has() ` ](/en-US/docs/Web/API/Headers/has)

    

Returns a boolean stating whether a ` Headers ` object contains a certain
header.

[ ` Headers.keys() ` ](/en-US/docs/Web/API/Headers/keys)

    

Returns an [ ` iterator ` ](/en-
US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing you to go
through all keys of the key/value pairs contained in this object.

[ ` Headers.set() ` ](/en-US/docs/Web/API/Headers/set)

    

Sets a new value for an existing header inside a ` Headers ` object, or adds
the header if it does not already exist.

[ ` Headers.values() ` ](/en-US/docs/Web/API/Headers/values)

    

Returns an [ ` iterator ` ](/en-
US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing you to go
through all va