Content type 'multipart/form-data;boundary=----…;charset=UTF-8' not supported

后端 未结 5 2294
误落风尘
误落风尘 2021-01-01 21:35

I want to send an object to the controller that has several lists with files and several fields with plain text.

public class ContributionNew

        
5条回答
  •  独厮守ぢ
    2021-01-01 21:48

    Instead of @RequestBody, use @ModelAttribute like,

    @PostMapping(value = "/{id}/contributions/photos")
    @ResponseStatus(HttpStatus.CREATED)
    public
    ResponseEntity createPhotoContribution(
            @ApiParam(value = "The movie ID", required = true)
            @PathVariable("id") final Long id,
            @ApiParam(value = "The contribution", required = true)
            @ModelAttribute @Valid final ContributionNew contribution
    ) {
    

提交回复
热议问题