-
Notifications
You must be signed in to change notification settings - Fork 29
feat: support multipart/form-data #132
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
domharrington
approved these changes
Aug 14, 2020
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.
💪
Holding off on merging this in until next week because after running some tests against our own API, { error: 'SPEC_INVALID',
message:
'The spec you uploaded isn\'t a valid JSON or YAML file. Here\'s the error we found: Not valid YAML',
suggestion:
'Try running your spec through a validator to see if they pick up any issues with the formatting!',
docs:
'https://docs.readme.com/developers/logs/********',
help:
'If you need help, email support@readme.io and include the following link to your API log: \'https://docs.readme.com/developers/logs/********\'.',
poem:
[ 'When we asked for your swagger',
'It seems you misunderstood',
'You sent us a cool attitude',
'Instead some JSON would have been good' ] } Turns out sending a data URL instead of file contents doesn't actually work in real-world scenarios. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:core
Issues related to `core`, which is the package that powers the SDKs at runtime
area:snippets
Issues related to code snippets
enhancement
New feature or request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧰 What's being changed?
multipart/form-data
requests and the ability to accept file uploads.In order to upload a file as part of a
multipart/form-data
request (or one of its supported variants), you can just give a path to the file as the value of the property in the parameters for the request. For example:This will automatically locate
owlbert.png
, read it into memory, convert it into data URL, and hand it off to fetch-har.You can also give it a stream, and the SDK will handle everything as well like magic.
Resolves #131 and #130