'How to response entity with file in order to be able see in Swagger as response entity in Json and file. I can only response entity or file
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity saveCharacter(
@RequestParam(name = "name") String name,
@RequestParam(name = "description") String description,
@RequestParam(name ="image", required = true ) MultipartFile image){
MarvelCharacter marvelCharacter = new MarvelCharacter();
marvelCharacter.setName(name);
marvelCharacter.setDescription(description);
MarvelCharacter character1 =
characterService.saveCharacterWithImage(image,marvelCharacter);
return new ResponseEntity<>( marvelCharacter,HttpStatus.OK);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|