Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter fix #350

Merged
merged 3 commits into from May 28, 2015
Merged

Filter fix #350

merged 3 commits into from May 28, 2015

Conversation

@arb
Copy link
Contributor

arb commented May 28, 2015

Fixes potential issue when replying with objects that have .toString methods directly attached to them such as Mongoose objects.

@arb arb added this to the 6.1.4 milestone May 28, 2015
@arb arb added the bug label May 28, 2015
@arb arb assigned Marsup and unassigned Marsup May 28, 2015
@@ -94,19 +94,19 @@ exports.GreatResponse = function (request, options, filterRules) {
}

if (this.isLeaf) {
if (filterRules[this.key] || filterRules[this.parent.key]) {
var filter = filterRules.hasOwnProperty(this.key) || filterRules.hasOwnProperty(this.parent.key);

This comment has been minimized.

Copy link
@cjihrig

cjihrig May 28, 2015

Contributor

Do you need to check if it exists and then get it? Could you just get it and see if it exists? If so, it would condense this and the next few lines a bit.

This comment has been minimized.

Copy link
@cjihrig

cjihrig May 28, 2015

Contributor

In my head, getOwnProperty() was a thing. Sorry. Carry on.


var samplePayload = {
message: 'test',
toString: function () { }

This comment has been minimized.

Copy link
@cjihrig

cjihrig May 28, 2015

Contributor

Does this one liner pass linting?

@arb arb force-pushed the arb:filter-fix branch from 71a03da to 88a97d2 May 28, 2015
@arb arb force-pushed the arb:filter-fix branch from 88a97d2 to 91c3ebd May 28, 2015
arb added a commit that referenced this pull request May 28, 2015
Filter fix
@arb arb merged commit 1ce6101 into hapijs:master May 28, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@arb arb deleted the arb:filter-fix branch May 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.