Swagger UI File Upload for Scala Play help

19 views
Skip to first unread message

Lee

unread,
Apr 10, 2018, 2:46:22 PM4/10/18
to Swagger
Hello,

I have searched through the group and petstore example but could not find a good Scala example to upload file. 

I managed to get the button to show up on swagger UI with the following annotations:


  @ApiOperation(httpMethod = "POST", consumes = "multipart/form-data")
  @ApiResponses(Array(
    new ApiResponse(code = 400, message = "Invalid file format")))
  @ApiImplicitParams(Array(
    new ApiImplicitParam(value = "Image file to attach", dataType = "file", paramType = "form")))
  def uploadImage = Action.async { request =>
     ...
  }

Unfortunately, when I inspect the data using request.body.asMultipartFormData, all the data lengths were zero.

What am I missing? Please let me know if you need more information to answer my question.

Thanks!


Reply all
Reply to author
Forward
0 new messages