Comparing version 1.3.0 to 1.4.0
@@ -16,3 +16,4 @@ 'use strict'; | ||
intervalMsec: 1000, | ||
root: false | ||
root: false, | ||
exclude: [] | ||
} | ||
@@ -71,2 +72,6 @@ }; | ||
if (settings.exclude.indexOf(request.path) !== -1) { | ||
return; | ||
} | ||
const update = internals.update('response', request); | ||
@@ -73,0 +78,0 @@ update.code = request.raw.res.statusCode; |
{ | ||
"name": "bananas", | ||
"description": "Minimal Loggly hapi plugin", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/bananas", |
@@ -186,2 +186,68 @@ 'use strict'; | ||
}); | ||
it('logs valid event', { parallel: false }, (done) => { | ||
const server = new Hapi.Server({ debug: false }); | ||
server.connection(); | ||
const settings = { | ||
token: 'abcdefg', | ||
intervalMsec: 50, | ||
exclude: ['/b'] | ||
}; | ||
let updates = []; | ||
const orig = Wreck.post; | ||
Wreck.post = function (uri, options, next) { | ||
updates = updates.concat(options.payload.split('\n')); | ||
return next(); | ||
}; | ||
server.register({ register: Bananas, options: settings }, (err) => { | ||
expect(err).to.not.exist(); | ||
server.route({ | ||
path: '/a', | ||
method: 'GET', | ||
handler: function (request, reply) { | ||
return reply('hello'); | ||
} | ||
}); | ||
server.route({ | ||
path: '/b', | ||
method: 'GET', | ||
handler: function (request, reply) { | ||
return reply('hello'); | ||
} | ||
}); | ||
server.start((err) => { | ||
expect(err).to.not.exist(); | ||
server.inject('/a', (res1) => { | ||
server.inject('/b', (res2) => { | ||
setTimeout(() => { | ||
expect(updates.length).to.equal(2); | ||
Wreck.post = orig; | ||
server.stop((err) => { | ||
expect(err).to.not.exist(); | ||
done(); | ||
}); | ||
}, 200); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11878
268