Skip to content

Response.variables.setHeaders

fx-fetch


fx-fetch / Response / setHeaders

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

Defined in: packages/fx-fetch/src/Response/setHeaders.ts:34

Clears existing headers and sets new headers in a Response.

(self, headers): Response

Clears existing headers and sets new headers in a Response.

Response

HeadersInput

Response

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

0.1.0

(headers): (self) => Response

Clears existing headers and sets new headers in a Response.

HeadersInput

(self): Response

Response

Response

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

0.1.0

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

0.1.0