BAEL-6054: Postman - send multi-part data and json in the same request (#14430)

This commit is contained in:
ACHRAF TAITAI 2023-07-17 21:55:25 +02:00 committed by GitHub
parent 5b5e921b22
commit 66ac6d8816
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import com.baeldung.postman.model.JsonRequest;
@ -23,4 +24,10 @@ public class PostmanUploadController {
return ResponseEntity.ok()
.body(json.getId() + json.getName());
}
@PostMapping("/uploadJsonAndMultipartData")
public ResponseEntity<String> handleJsonAndMultipartInput(@RequestPart("data") JsonRequest json, @RequestPart("file") MultipartFile file) {
return ResponseEntity.ok()
.body(json.getId() + json.getName());
}
}