New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

patch-headers

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patch-headers

Express middleware to patch response headers written by another handler or middleware

Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

patch-headers

Express middleware to patch response headers written by another handler or middleware.

Usage

The module returns a function to build a middleware. The function must be called with a single options object with one or more of the following properties:

  • allow: An array that contains a whitelist of header names.
  • remove: An array that contains a blacklist of header names.
  • static: An object with key value pairs of static header names and values.
  • callback: A function which has a single object parameter for the header key value pairs and returns an object in the same format.

Example

// load the module
const patchHeaders = require('patchHeaders')

// add the routing
app.use(patchHeaders({
  allow: ['Content-Length', 'Content-Type'],
  static: {
    'Access-Control-Allow-Origin': '*'
  }
})

Keywords

headers

FAQs

Package last updated on 22 May 2019

Related posts