Response.variables.setHeaders
fx-fetch / Response / setHeaders
Variable: setHeaders()
Section titled “Variable: setHeaders()”
constsetHeaders: {(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.
Call Signature
Section titled “Call Signature”(
self,headers):Response
Clears existing headers and sets new headers in a Response.
Parameters
Section titled “Parameters”headers
Section titled “headers”HeadersInput
Returns
Section titled “Returns”Example
Section titled “Example”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
Call Signature
Section titled “Call Signature”(
headers): (self) =>Response
Clears existing headers and sets new headers in a Response.
Parameters
Section titled “Parameters”headers
Section titled “headers”HeadersInput
Returns
Section titled “Returns”(
self):Response
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Example
Section titled “Example”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
Example
Section titled “Example”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