--------------------------------------------
On Mon, 1/30/17, tony tam <[email protected]> wrote:

 Subject: Re: POST a multipartfile
 To: [email protected]
 Date: Monday, January 30, 2017, 7:16 PM
 
 This works
 fine with the core swagger-jaxrs project.  You might need
 to file an issue on springfox (assuming you’re using that)
 to see what is wrong with your setup.
 On Jan 30, 2017, at 3:48 AM, antxa
 <[email protected]>
 wrote:
 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.
 
 
 
 
 -- 
 
 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.
 rimele semne ingrijoratoare privind destructurarea statala a Europei centrale 
si sud-estice  sub presiunea Marilor Puteri revizioniste  au fost corect 
receptionate la Bucuresti. Dupa ocuparea Austriei de catre Germania  12 martie 
1938   la Bucuresti se luau masuri imperative impotriva organizatiei extremiste 
de dreapta  Garda de Fier  iar la 30 aprilie 1938  in contextul declansarii 
crizei cehoslovace  era aprobata survolarea teritoriului romanesc de catre 
avioanele achizitionate de Cehoslovacia din URSS.

-- 
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.

Reply via email to