mac- / ratify

A Hapi plugin for validating the schema of path, query, request body, and response body params using JSON-schema
MIT License
71 stars 27 forks source link

Node v6 - TypeError thrown when validating parsed querystring objects #51

Closed alexcorre closed 7 years ago

alexcorre commented 7 years ago

Core node module querystring was updated in Node v6 to return plain objects that do not prototypically extend from the JavaScript Object.

According to the Node docs:

This means that the typical Object methods such as obj.toString(), obj.hasOwnProperty(), and others are not defined and will not work.

See Node.js PR here: https://github.com/nodejs/node/pull/6055

breaking changes list for v5-v6: https://github.com/nodejs/node/wiki/Breaking-changes-between-v5-and-v6#querystring

As a result of this change, this packages validation of parsed query strings throws an error on this line when the var object is a parsed query string:

https://github.com/mac-/ratify/blob/master/lib/RouteSchemaManager.js#L117

mac- commented 7 years ago

Thanks for the fix! I'll try to get this merged/published tonight.

alexcorre commented 7 years ago

Thanks @mac- for merging. I see you released 3.0.0 to npm, but neglected to push the version bump and tag to github. Hard to verify that the release contains my fix without installing.

Are you planning to update github with the release version bump + tag?

Thanks!

mac- commented 7 years ago

yeah sorry... I'll get those pushed as well