Skip to content

poppinlp/fastify-expect-ct

Repository files navigation

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

About

Fastify plugin to set the Expect-CT header

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published