Skip to content

Commit

Permalink
Merge pull request #586 from http-party/logFn-skip-array
Browse files Browse the repository at this point in the history
Only add logFn function to before if logFn exists
  • Loading branch information
thornjad authored Mar 24, 2020
2 parents 924567f + 3571e18 commit e758f03
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,12 @@ function HttpServer(options) {

var before = options.before ? options.before.slice() : [];

before.push(function (req, res) {
if (options.logFn) {
if (options.logFn) {
before.push(function (req, res) {
options.logFn(req, res);
}

res.emit('next');
});
res.emit('next');
});
}

if (options.username || options.password) {
before.push(function (req, res) {
Expand Down

0 comments on commit e758f03

Please sign in to comment.