-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[GO][Client] Multipart/form-data Request Support More Than One File #10843
[GO][Client] Multipart/form-data Request Support More Than One File #10843
Conversation
performing an upload, use a slice of files so an arbitrary number of files can be used in the form.
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.
Can you create a schema with an endpoint that is using multiple form files?
Do you want an the PetStore example updated or do you want to see it as part of this PR description? |
The best option would be creating new folder (e.g. |
I added a basic single endpoint OA3 schema with the corresponding Go Client go into |
secondFile: | ||
description: another file to upload | ||
type: string | ||
format: binary |
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.
Do we want to add it to this file? It will affect all clients.
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.
I went ahead and removed it. Looking through active and closed bugs, it looks like other clients have been impacted by this issue to.
that contains two files to be uploaded
14cab89
to
1832c96
Compare
LGTM but I've not thoroughly tested it locally |
The Go client will iterate over the files for a multipart/form-data request and add each file to a slice of
formFiles
.Added a private struct
formFile
that contains the already defined values of aformFile
. A Request now creates an empty slice offormFiles
in which files are appended into.The
prepareRequest
function will now iterate over the slice offormFiles
to add each one to the request.Addresses #8322
An example snippet of a schema that has the problem being addressed, note the second file in the multipart/form-data request body:
@antihax @grokify @kemokemo @jirikuncar @ph4r5h4d
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(5.3.0),6.0.x