Skip to content

Commit 3cb7e55

Browse files
Wynn TeoWynn Teo
authored andcommitted
Update the method naming
1 parent 8be3a61 commit 3cb7e55

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/postman/controller/PostmanUploadController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public ResponseEntity<String> handleSingleFileUpload(@RequestParam("file") Multi
3737
return ResponseEntity.ok("file received successfully");
3838
}
3939

40-
@PostMapping(value = "/uploadJsonAndMultipartData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
41-
public ResponseEntity<String> handleUploadeJsonAndMultipartInput(@RequestPart("data") JsonRequest json, @RequestPart("file") MultipartFile file) {
40+
@PostMapping(value = "/uploadJsonAndMultipartInput", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
41+
public ResponseEntity<String> handleUploadJsonAndMultipartInput(@RequestPart("data") JsonRequest json, @RequestPart("file") MultipartFile file) {
4242
return ResponseEntity.ok(json.getId() + json.getName());
4343
}
4444
}

spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/postman/controller/PostmanUploadControllerUnitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void givenJsonAndFile_whenUploadJsonAndMultipart_thenSuccessReturned() th
5656
MockMultipartFile jsonPart = new MockMultipartFile("data", "", "application/json", jsonString.getBytes());
5757
MockMultipartFile filePart = new MockMultipartFile("file", "test.txt", "text/plain", "some file content".getBytes());
5858

59-
this.mockMvc.perform(MockMvcRequestBuilders.multipart("/uploadJsonAndMultipartData")
59+
this.mockMvc.perform(MockMvcRequestBuilders.multipart("/uploadJsonAndMultipartInput")
6060
.file(jsonPart)
6161
.file(filePart))
6262
.andExpect(status().isOk())

0 commit comments

Comments
 (0)