Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/opine/src/response.ts>Response#setHeader

Fast, minimalist web framework for Deno ported from ExpressJS.
Very Popular
Go to Latest
method Response.prototype.setHeader
import { Response } from "https://deno.land/x/opine@2.2.0/src/response.ts";

Set header field to value, or pass an object of header fields.

alias for res.set()

Examples:

res.setHeader('Accept', 'application/json');
res.setHeader({
  'Accept-Language': "en-US, en;q=0.5",
  'Accept': 'text/html',
});

Parameters

field: string
value: string

Returns

this

for chaining

Parameters

obj: Record<string, string>