Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
node: setAllowHeader()
import { NextFunction, Request, Response } from 'express';
* Sets Allow header.
* "The Allow header lists the set of methods support by a resource.
* This header must be sent if the server responds with a 405 Method Not Allowed
* status code to indicate which request methods can be used."
* @see
export const setAllowHeader = (req: Request, res: Response, next: NextFunction) => {
res.set('allow', 'GET, POST, OPTIONS');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment