Skip to content

Response.variables.getHeader

fx-fetch


fx-fetch / Response / getHeader

const getHeader: {(self, name): readonly string[] | undefined; (name): (self) => readonly string[] | undefined; }

Defined in: packages/fx-fetch/src/Response/getHeader.ts:30

Retrieves the values of a specific header from a Response.

(self, name): readonly string[] | undefined

Retrieves the values of a specific header from a Response.

Response

string

readonly string[] | undefined

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

(name): (self) => readonly string[] | undefined

Retrieves the values of a specific header from a Response.

string

(self): readonly string[] | undefined

Response

readonly string[] | undefined

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

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