-
Notifications
You must be signed in to change notification settings - Fork 13
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
Safer buildQueryString #94
Conversation
Generate changelog in
|
Looks like the typings are overly lenient. In practice this doesn't regularly come up since Since it is technically legal to pass anything as a query param, it doesn't hurt to be defensive |
@@ -190,7 +190,11 @@ export class FetchBridge implements IHttpApiBridge { | |||
return path; | |||
} | |||
|
|||
private buildQueryString(data: { [key: string]: any }) { | |||
private buildQueryString(data: any) { | |||
if (data == null) { |
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.
this should be sufficient since Object.keys()
seems to coerce all other types correctly
👍 |
The autorelease label is not supported for this repository type. Please merge this PR first and then use the Autorelease UI |
1 similar comment
The autorelease label is not supported for this repository type. Please merge this PR first and then use the Autorelease UI |
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.
We shouldn't cut a major rev of this repo just to change a typing that only impacts tests. I would prefer to either add a defensive check to ensure the object is not null
Removed break |
great! thanks for the fix @johnwiseheart |
looks like changelog-app is confused... |
Yeah I think theres something weird going on, don't think https://github.com/palantir/conjure-typescript-runtime/blob/develop/changelog/%40unreleased/pr-82.v2.yml should still be in |
Before this PR
buildQueryString
assumed it would take an object, and then iterated through its keys. However, because in both of its uses it was being passed anany
, it was not guaranteed that it is an object. This lead to conjure-client-factory passingparams.queryArguments = undefined
, which would cause an error.After this PR
==COMMIT_MSG==
Check that queryArguments is non-null before iterating over keys
==COMMIT_MSG==