-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement GET query params #33
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work! I have a few comments below. I'm not sure changes are required, but I think so? Let me know what you think.
index.js
Outdated
} | ||
query = Object.keys(queryObject) | ||
// Filter any keys with values that evaluate to false | ||
.filter(key => !!queryObject[key]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this desirable? Could there not be a case where sending a zero makes sense and should be possible? If I'm not mistaken, a query-object like { max_length: 0 }
will be a no-op. Is that good? I'm not sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right! I will filter on !== false instead.
index.js
Outdated
if(queryObject[key] === true) { | ||
return key; | ||
} else { | ||
return key + '=' + queryObject[key]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it deal with escaping/URL encoding? What happens if you pass an object like { foo: "bar&baz" }
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this could present problems, I will add url encoding.
…rt that invalid query argument location throws error
Resolves #32