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

Add support for file_link_data in file creation requests #840

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

ob-stripe
Copy link
Contributor

r? @brandur-stripe
cc @stripe/api-libraries

Add support for file_link_data in file creation requests.

The implementation is a bit of a hack: it uses form to flatten and stringify the contents of file_link_data, then parses the resulting query string to add the key/value pairs to the multipart buffer.

I've manually checked the contents of the request:

--554f676cf198d9e32740e881eb8cf161d311586da9b3cceaea7fcbe06135
Content-Disposition: form-data; name="purpose"

dispute_evidence
--554f676cf198d9e32740e881eb8cf161d311586da9b3cceaea7fcbe06135
Content-Disposition: form-data; name="file"; filename="test_data.pdf"
Content-Type: application/octet-stream

<snip>

--554f676cf198d9e32740e881eb8cf161d311586da9b3cceaea7fcbe06135
Content-Disposition: form-data; name="file_link_data[metadata][foo]"

bar
--554f676cf198d9e32740e881eb8cf161d311586da9b3cceaea7fcbe06135
Content-Disposition: form-data; name="file_link_data[create]"

true
--554f676cf198d9e32740e881eb8cf161d311586da9b3cceaea7fcbe06135--

Copy link
Contributor

@brandur-stripe brandur-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@remi-stripe remi-stripe merged commit 61affa3 into master Apr 30, 2019
@remi-stripe remi-stripe deleted the ob-file-link-data branch April 30, 2019 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants