Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
// SPDX-License-Identifier: 0BSD
import { type IncomingMessage } from "node:http";
import nodeAccepts from "npm:accepts";
export function accepts(req: Request) {
const headers = {
accept: req.headers.get("accept"),
"accept-charset": req.headers.get("accept-charset"),
"accept-encoding": req.headers.get("accept-encoding"),
"accept-language": req.headers.get("accept-language"),
};
return nodeAccepts({ headers } as unknown as IncomingMessage);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 19, 2024