import { withHeader } from "https://deno.land/x/referrer_policy_middleware@1.0.0/deps.ts";
Return an instance with the provided Request
replacing the specified header.
There are no side effects on the original Request
.
Examples
Example 1
Example 1
import { withHeader } from "https://deno.land/x/http_utils@$VERSION/message.ts";
import { assert } from "https://deno.land/std@$VERSION/testing/asserts.ts";
declare const init: Request;
declare const header: string;
declare const value: string;
const request = withHeader(init, header, value);
assert(request.headers.get(header), value);
assert(init !== request);
Return an instance with the provided Response
replacing the specified header.
There are no side effects on the original Response
.
Examples
Example 1
Example 1
import { withHeader } from "https://deno.land/x/http_utils@$VERSION/message.ts";
import { assert } from "https://deno.land/std@$VERSION/testing/asserts.ts";
declare const init: Response;
declare const header: string;
declare const value: string;
const response = withHeader(init, header, value);
assert(response.headers.get(header), value);
assert(init !== response);