-
Notifications
You must be signed in to change notification settings - Fork 365
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
Fix encoding of nested parameters in multipart requests #735
Fix encoding of nested parameters in multipart requests #735
Conversation
+ key + ".", null, null, null, 0, null | ||
); | ||
} | ||
multipartProcessor.addFileField(key, "blob", inputStream); |
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.
The two branches above are the same as before.
Only else
branch below delegates the the flatten params used by createQuery
in normal request method type
+ "Please check our API reference for the parameter type, " | ||
+ "or use the provided parameter class instead.", | ||
value, keyPrefix), | ||
keyPrefix, null, null, 0, 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.
The error here could arise if:
- users pass file object to non-multipart request at any level.
- multi-part request params having nested file objects
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.
👍 Excellent, thanks for adding an explicit check and error.
} | ||
|
||
multipartProcessor = new MultipartProcessor(conn, boundary, ApiResource.CHARSET); | ||
encodeMultipartParams(multipartProcessor, params); |
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.
Alternative design here is to have encodeParams
as a method to multipartprocessor itself.
However, we still want to use the same flattenParams
and LiveRequestGetter.Parameter
within in class.
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.
Looks great! Thanks for the quick fix :)
+ "Please check our API reference for the parameter type, " | ||
+ "or use the provided parameter class instead.", | ||
value, keyPrefix), | ||
keyPrefix, null, null, 0, 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.
👍 Excellent, thanks for adding an explicit check and error.
r? @ob-stripe
cc @remi-stripe @stripe/api-libraries