BAEL-6054: Postman - send multi-part data and json in the same request (#14430)
This commit is contained in:
parent
5b5e921b22
commit
66ac6d8816
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue