Skip to content

Response.variables.appendHeaders

fx-fetch


fx-fetch / Response / appendHeaders

const appendHeaders: {(self, headers): Response; (headers): (self) => Response; }

Defined in: packages/fx-fetch/src/Response/appendHeaders.ts:33

Merges new headers into a Response, appending values to existing headers.

(self, headers): Response

Merges new headers into a Response, appending values to existing headers.

Response

HeadersInput

Response

import { Response } from 'fx-fetch';
const response = Response.make({ url: 'https://api.example.com' });
const responseWithMergedHeaders = Response.appendHeaders(response, {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
});

0.1.0

(headers): (self) => Response

Merges new headers into a Response, appending values to existing headers.

HeadersInput

(self): Response

Response

Response

import { Response } from 'fx-fetch';
import { pipe } from 'effect';
const response = Response.make({ url: 'https://api.example.com' });
const responseWithMergedHeaders = pipe(
response,
Response.appendHeaders({
'X-API-Version': 'v2',
'X-Client-ID': 'webapp'
})
);

0.1.0

import { Response } from 'fx-fetch';
const response = Response.make({ url: 'https://api.example.com' });
const responseWithMergedHeaders = Response.appendHeaders(response, {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
});

0.1.0