Kong / mashape-oauth

OAuth Modules for Node.js - Supporting RSA, HMAC, PLAINTEXT, 2,3-Legged, 1.0a, Echo, XAuth, and 2.0

Home Page:http://oauthbible.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

authHeader() throws "TypeError: context.hasOwnProperty is not a function" when body is a query string

laurence-myers opened this issue · comments

authHeader() -> prepareParameters() -> utils.extend()

prepareParameters() parses the body using "querystring"."parse()". utils.extend then attempts to call ".hasOwnProperty()" on the parsed querystring object. This property doesn't exist, due to missing prototype inheritance. The node.js documentation states:

Note: The object returned by the querystring.parse() method does not prototypically inherit from the JavaScript Object. This means that typical Object methods such as obj.toString(), obj.hasOwnProperty(), and others are not defined and will not work.

Tested on Node v6.9.1.

Should already be resolved with #26, but that fix has not be published to npm yet. See #29.