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

hapi-csv

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-csv - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

12

lib/index.js

@@ -5,3 +5,2 @@ 'use strict';

const Hoek = require('hoek');
const Accepts = require('accepts');

@@ -49,2 +48,4 @@

// Check for header and route mapping and convert and reply with csv if needed
const allowedTypesRegex = /(text\/csv)|(application\/csv)/i;
server.ext('onPreResponse', (request, reply) => {

@@ -61,8 +62,5 @@

const oldAcceptHeader = request.headers.accept;
request.headers.accept = request.headers.accept.replace(/\*\/\*/g, '');
const result = allowedTypesRegex.exec(request.headers.accept);
const preferedType = result && result[0];
const accept = Accepts(request);
const preferedType = accept.types(['text/csv', 'application/csv']);
if (preferedType && internals.routeMap.has(request.route.path)) {

@@ -79,4 +77,2 @@ const schema = internals.routeMap.get(request.route.path);

request.headers.accept = oldAcceptHeader;
return reply.continue();

@@ -83,0 +79,0 @@ });

{
"name": "hapi-csv",
"version": "2.4.1",
"version": "2.4.2",
"description": "Hapi plugin for converting a Joi response schema and dataset to csv",

@@ -24,3 +24,2 @@ "main": "lib/index.js",

"dependencies": {
"accepts": "1.3.x",
"hoek": "4.x.x"

@@ -27,0 +26,0 @@ },

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