Hi all,
I've implemented a REST API in Java and one of the POST request accepts a
file sent in the body. Everything works OK if I call using this curl:
curl -F "[email protected]" localhost:8080/index
The problem is that I want to use Swagger for the documentation, and I'm
not able to get the same curl through swagger-ui.
This is my snippet code:
@ApiOperation(value = "Index a single document", notes = "...", response =
ResultIndex.class)
@RequestMapping(value = "/index", method = RequestMethod.POST, consumes
={ MediaType.MULTIPART_FORM_DATA_VALUE }, produces = "application/json")
@ApiImplicitParams({
@ApiImplicitParam(name = "doc", value = "...", required = true, dataType =
"file", paramType = "form")})
public ResultIndex index(@RequestPart(value="doc", required=true)
MultipartFile doc)
And this produces the following curl on the swagger-ui:
curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept:
application/json' {"type":"formData"} 'http://localhost:8080/index'
What's wrong in my code?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.