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

hapi-dribble

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-dribble - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

.git/COMMIT_EDITMSG

1

.eslintrc.js

@@ -11,2 +11,3 @@ module.exports = {

"sourceType": "script",
"ecmaVersion": 8,
"ecmaFeatures": {

@@ -13,0 +14,0 @@ "modules": false,

21

lib/index.js

@@ -42,3 +42,3 @@ 'use strict';

const filterResponse = (request, reply) => {
const filterResponse = (request, h) => {
const config = request.route.settings.plugins.dribble;

@@ -48,3 +48,3 @@

if (!config) {
return reply.continue();
return h.continue;
}

@@ -55,3 +55,3 @@

if (!match) {
return reply.continue();
return h.continue;
}

@@ -64,13 +64,10 @@

return reply.continue();
return h.continue;
};
exports.register = (server, options, next) => {
server.ext('onPreResponse', filterResponse);
next();
exports.plugin = {
pkg: require('../package.json'),
register: async function register(server) {
server.ext('onPreResponse', filterResponse);
}
};
exports.register.attributes = {
name: 'hapi-dribble',
version: '1.0.0'
};
{
"name": "hapi-dribble",
"version": "1.0.1",
"version": "2.0.0",
"description": "dynamically filter api responses",

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

"eslint-plugin-import": "^1.7.0",
"hapi": "^16.1.0",
"hapi": "^17.0.0",
"lab": "^13.0.1"

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

@@ -27,5 +27,5 @@ # hapi-dribble

omit: ['user.id']
deep: {[
{ for: 'user.data': omit: ['personal'] }
]}
deep: [
{ for: 'user.data', omit: ['personal'] }
]
}

@@ -38,5 +38,5 @@ },

keep: ['user', 'meta']
deep: {[
{ for: 'user.data': omit: ['personal'] }
]}
deep: [
{ for: 'user.data', omit: ['personal'] }
]
}

@@ -43,0 +43,0 @@ }

@@ -14,30 +14,34 @@ 'use strict';

const testFilter = (options, done) => {
const server = new Hapi.Server();
server.connection();
const testFilter = async (options, done) => {
const server = Hapi.server();
server.register(require('../lib'), () => {
// eslint-disable-next-line no-unused-expressions
await server.register(require('../lib'));
server.route({
method: 'GET',
path: '/filter',
config: {
plugins: {
dribble: {
all: {
rule: () => true,
filter: options.filter
}
server.route({
method: 'GET',
path: '/filter',
config: {
plugins: {
dribble: {
all: {
rule: () => true,
filter: options.filter
}
},
handler: (request, reply) =>
reply(options.fixture).code(200)
}
});
}
},
handler: (request, h) =>
h.response(options.fixture).code(200)
}
});
server.inject('/filter', (res) => {
expect(JSON.parse(res.payload)).to.equal(options.expected);
done();
});
});
const injectOptions = {
method: 'GET',
url: '/filter'
};
const res = await server.inject(injectOptions);
expect(JSON.parse(res.payload)).to.equal(options.expected);
done();
};

@@ -44,0 +48,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