Response.variables.getHeader
fx-fetch / Response / getHeader
Variable: getHeader()
Section titled “Variable: getHeader()”
constgetHeader: {(self,name): readonlystring[] |undefined; (name): (self) => readonlystring[] |undefined; }
Defined in: packages/fx-fetch/src/Response/getHeader.ts:30
Retrieves the values of a specific header from a Response.
Call Signature
Section titled “Call Signature”(
self,name): readonlystring[] |undefined
Retrieves the values of a specific header from a Response.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”readonly string[] | undefined
Example
Section titled “Example”import { Response } from 'fx-fetch';
const response = Response.make({ url: 'https://api.example.com', headers: { 'Authorization': 'Bearer token', },});
const authHeader = getHeader(response, 'Authorization');console.log(authHeader); // ['Bearer token']0.1.0
Call Signature
Section titled “Call Signature”(
name): (self) => readonlystring[] |undefined
Retrieves the values of a specific header from a Response.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”(
self): readonlystring[] |undefined
Parameters
Section titled “Parameters”Returns
Section titled “Returns”readonly string[] | undefined
Example
Section titled “Example”import { Response } from 'fx-fetch';
const response = Response.make({ url: 'https://api.example.com', headers: { 'Authorization': 'Bearer token', },});
const authHeader = response.pipe( getHeader('Authorization'));console.log(authHeader); // ['Bearer token']0.1.0
Example
Section titled “Example”import { Response } from 'fx-fetch';
const response = Response.make({ url: 'https://api.example.com', headers: { 'Authorization': 'Bearer token', },});
const authHeader = getHeader(response, 'Authorization');console.log(authHeader); // ['Bearer token']0.1.0