fastify-expect-ct

0.3.0 • Public • Published

fastify-expect-ct

Build Status Code coverage Code style Dependency Status Dev Dependency Status NPM version NPM downloads NPM license

Fastify plugin to set the Expect-CT header

Why?

You may know expect-ct as a expect-ct middleware used in helmet. And you could use it as a middleware in fastify also. So why i made this plugin?

You may find the reason in benchmark result and wish you like it. :)

Difference

This plugin has passed all expect-ct test cases. And no difference in options.

Install

Via npm:

npm i fastify-expect-ct

Via yarn:

yarn add fastify-expect-ct

Usage

const fastify = require('fastify');
const fastifyExpectCt = require('fastify-expect-ct');
 
const app = fastify();
app.register(fastifyExpectCt, {
  // Your options
});
 
app.listen(3000, err => {
  if (err) throw err;
});

Options

This plugin has the same options as the middleware in helmet.

maxAge {number}

Set max-age in header. Default is 0. Plugin will use default value if you passed in a non-numeric value.

enforce {boolean}

Set enforce value in header. Default is false.

reportUri {string}

Set reportUri value in header. Default is empty.

Changelog

  • 0.3.0
    • Use expect-ct test cases
  • 0.2.0
    • Add test case
    • Add code coverage
    • Add benchmarks
  • 0.1.0:
    • Init version

Package Sidebar

Install

npm i fastify-expect-ct

Weekly Downloads

4

Version

0.3.0

License

MIT

Unpacked Size

5.96 kB

Total Files

4

Last publish

Collaborators

  • poppinl