0.1.1 • Published 2 years ago

@cfpreview/pages-plugins-headers v0.1.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Pages Plugins

Headers

This headers plugin adds headers to all responses which occur below it in the execution chain.

Installation

npm install --save @cfpreview/pages-plugins-headers

Usage

// ./functions/api/_middleware.ts

import headersPlugin from "@cfpreview/pages-plugins-headers";

export const onRequest: PagesFunction = headersPlugin({
  "Access-Control-Allow-Origin": "*",
});

The plugin takes the same argument as the new Headers() constructor:

  • a Headers instance,
  • an object of header names mapping to header values (i.e. Record<string, string>), or
  • an array of header name, header value pairs (i.e. [string, string][]).
0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago