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

Wrong curl for the uploading of a file #2178

Closed
AlexElin opened this issue May 25, 2016 · 2 comments
Closed

Wrong curl for the uploading of a file #2178

AlexElin opened this issue May 25, 2016 · 2 comments
Milestone

Comments

@AlexElin
Copy link

Swagger-ui (v 2.1.4) gets wrong curl for file uploading.

I upload a file on http://petstore.swagger.io/#!/pet/uploadFile.
Swagger gets the curl:
curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' 'http://petstore.swagger.io/v2/pet/1/uploadImage'

Although the curl should be like:
curl -F "file=@/pathToFile" 'http://petstore.swagger.io/v2/pet/1/uploadImage'

see the http://stackoverflow.com/questions/12667797/using-curl-to-upload-post-data-with-files and https://curl.haxx.se/docs/manpage.html

@fehguy
Copy link
Contributor

fehguy commented Jun 16, 2016

I think this would be nice, but it's impossible to do so. The @pathToFile is strictly forbidden from javascript so there is no way to get the path from the browser (browsers will send fakepath as the path location).

It would, however, be better if we showed the file name instead, which is possible.

fehguy added a commit to swagger-api/swagger-js that referenced this issue Jun 16, 2016
@fehguy
Copy link
Contributor

fehguy commented Jun 16, 2016

fixed in efb7765

@fehguy fehguy closed this as completed Jun 16, 2016
@fehguy fehguy added this to the v2.2.1 milestone Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants