Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-etagger

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-etagger

Hapi plug-in for etags and HTTP 304 support

  • 1.0.0-beta.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
162
increased by29.6%
Maintainers
1
Weekly downloads
 
Created
Source

hapi-etagger

Hapi plug-in for etags and HTTP 304 support. It utilizes the popular etag library.

Build Status Coverage Status node code style License Status

Tested with Node 12/13 and Hapi 19. Should also work with Hapi 17 and 18.

Install

npm install hapi-etagger

Purpose

This plug-in provides a simple way to support etags and HTTP 304.

By default, it adds etags and HTTP 304 support to all requests that meet the following criteria:

  • method is GET
  • status code is 2xx
  • response payload is a String, a stringifyable object or a Buffer

It is possible to opt-out.

Usage

Register the plugin with Hapi server like this:

const Hapi = require('@hapi/hapi');
const etags = require('hapi-etagger');

const server = new Hapi.Server({
  port: 3000,
});

const provision = async () => {
  await server.register(etags);
  // ...
  await server.start();
};

provision();

You can opt-out by route configuration, e.g.:

server.route({
  method: 'GET',
  path: '/example/{id}',
  options: {
    // ...
    plugins: {
      'hapi-etagger': {
        enabled: false, // opt-out
      },
    },
  },
  // ...
});

Keywords

FAQs

Package last updated on 02 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc