-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Closed
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.com
Description
I'm migrating a rest service developed with spring-boot 2 to use webflux. This rest service is used to upload 2 files using multipart. The first part "file" is usually a PDF file, and the second part "metadata" is a json file with metadata. Here is an example of this webservice:
package com.sngular.controller;
import com.sngular.model.Metadata;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
public class MultipartController {
@PostMapping(value = "/upload", consumes = {"multipart/form-data"})
public String fileUpload(@RequestPart(value = "metadata", required = true) Metadata metadata,
@RequestPart(value = "file", required = true) MultipartFile file) {
return "ok";
}
}
this REST service works fine when I use the dependency spring-boot-starter-web, when I change it to use spring-boot-starter-webflux It give me the following error when trying to upload the files:
{
"timestamp": "2018-05-25T20:36:03.505+0000",
"path": "/upload",
"status": 415,
"error": "Unsupported Media Type",
"message": "Content type 'application/pdf' not supported"
}
this example can be found on the following repository:
And the postman request Im executing..
Any thoughts on why this gives me the error Content type 'application/pdf' not supported or how to solve this?
Metadata
Metadata
Assignees
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.com