From ec6946e6ed1b2e8eb00a96bec7be5f4acba69ded Mon Sep 17 00:00:00 2001 From: Mike Nicholson Date: Sun, 30 Oct 2016 20:58:29 -0400 Subject: [PATCH] Demonstrate integration issue with querystring The result of querystring.parse(), ParsedQueryString, does not inherit from Object.prototype, causing a type error "hasOwnProperty is not a function. This test demonstrates that problem as reported in pull request #77 "Fix body field extractor" --- test/extrators-test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/extrators-test.js b/test/extrators-test.js index f29685f5..9abc5868 100644 --- a/test/extrators-test.js +++ b/test/extrators-test.js @@ -59,6 +59,17 @@ describe('Token extractor', function() { expect(token).to.equal('abcd123'); }); + + + it('should work properly with querystring', function() { + var req = new Request(); + const querystring = require('querystring'); + req.body = querystring.parse('test_field=abcd123') + + var token = extractor(req); + + expect(token).to.equal('abcd123') + }); });