-
Notifications
You must be signed in to change notification settings - Fork 9k
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
File upload always sends 47 byte body #1416
Comments
I also noticed that swagger-ui sends the request as |
Which version of swagger-ui do you use? If you want to use file upload, you have to use the |
Thanks for looking into this. I'm using the latest Springfox swagger-ui, which uses swagger-ui 2.1.0 underneath the hood. Let me phrase my question another way. How can one invoke a |
Any update on this? |
I'd need to see the Swagger definition you get for the file upload. |
Sorry about that. Here's the relevant portion of the swagger json. "put": {
"tags":
[
"documents"
],
"summary": "Create or update a hosted document",
"description": "An accompanying metadata resource at /metadata/{id} must already exist. Attempts to create/update an externally hosted document will be redirected.",
"operationId": "putDocumentUsingPUT",
"consumes":
[
"*/*"
],
"produces":
[
"*/*"
],
"parameters":
[
{
"name": "id",
"in": "path",
"description": "id",
"required": true,
"type": "string"
},
{
"name": "Content-MD5",
"in": "header",
"description": "md5",
"required": false,
"type": "ref"
},
{
"in": "body",
"name": "document",
"description": "document",
"required": true,
"schema":
{
"$ref": "#/definitions/file"
}
}
],
"responses":
{
"200":
{
"description": "OK",
"schema":
{
"type": "string"
}
},
"201":
{
"description": "Document created"
},
"204":
{
"description": "Document updated"
},
"400":
{
"description": "Metadata must be created first|The Content-MD5 you specified did not match what we received."
}
}
}, |
Unfortunately, that's a partial definition and I can't test with it. That shouldn't give you the option to upload a file, and is not the way to describe file uploads using Swagger. |
Please reopen if you're still having an issue. From looking at your spec file, you were using an incomplete swagger implementation or one with a bug. |
I'm trying to make use of the swagger-ui file upload feature. My Spring MVC endpoint is annotated as such:
swagger-ui correctly displays the file chooser, but when I select a file and click "Try It Out", the content size of the request sent to my server is always just 47 bytes. I am using Firefox 38.0.5 on Windows 7. Here's a screenshot of the request details captured by Firefox:
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: