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