Having a function for lookup seems to only work for the first request
See original GitHub issueI “consoled” the block about the lookup option being a function:
if (typeof(opts.lookup) === 'function') {
console.log('1:' + opts.lookup);
middleware = function (middleware, req, res, next) {
console.log('2:' + opts.lookup);
return opts.lookup(req, res, opts, function () {
console.log('3:' + opts.lookup);
return middleware(req, res, next)
})
}.bind(this, middleware)
}
Then I booted the server:
Tue Sep 29 2015 12:38:06 GMT-0400 (EDT): 1:function (req, res, opts, next) {
if (req.body && req.body.uuid) {
opts.lookup = ['body.uuid', 'params.uid'];
} else {
opts.lookup = ['connection.remoteAddress', 'params.uid'];
opts.total = 100;
}
return next();
}
Then I ran the first request:
2:function (req, res, opts, next) {
if (req.body && req.body.uuid) {
opts.lookup = ['body.uuid', 'params.uid'];
} else {
opts.lookup = ['connection.remoteAddress', 'params.uid'];
opts.total = 100;
}
return next();
}
3:connection.remoteAddress,params.uid
Then I ran the second request:
2:connection.remoteAddress,params.uid
Tue Sep 29 2015 12:38:23 GMT-0400 (EDT): TypeError: Property 'lookup' of object #<Object> is not a function
Notice the second go console log 2 has been updated to what was console log 3’s.
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
LOOKUP function - Microsoft Support
How to use the LOOKUP function in Excel to search in a single row or column and find a value from the same...
Read more >6 Reasons Why Your VLOOKUP is Not Working - Ablebits
The VLOOKUP function can only return one record. It will return the first record that matches the value you looked for. If your...
Read more >LOOKUP FUNCTION ANNOYANCES - Excel ... - O'Reilly
The first function you can use to find a value in a worksheet is the LOOKUP() function. Basically, the LOOKUP() function identifies a...
Read more >Find the Matching Value When the Lookup Value Is Not on the ...
This article shows you how to find matching value when the lookup value is not on the first column of the table array....
Read more >Excel LOOKUP Function - Xelplus - Leila Gharani
Excel has many functions capable of performing lookups: VLOOKUP, ... However, the function that started it all was the original LOOKUP ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
New release please @ded
Just ran into this too, any word on a new release @ded?