@PutMapping(value = "/user", consumes = "multipart/form-data")
public ResponseEntity<?> updateUserProfile(@Login long user,
@RequestPart("file") MultipartFile file,
@RequestBdoy Dto userDto){
포스트맨에서 PUT 메소드로 api를 호출하는 순간 다음 에러가 발생했다.
http status : 415
content type 'multipart/form-data boundary=' not supported postman
내가 원하는 것은 JSON 형식의 데이터와 Multipart 이미지를 동시에 보내는 것이기에 다음 방식으로 문제를 해결했다.
@PutMapping(value = "/user", consumes = "multipart/form-data")
public ResponseEntity<?> updateUserProfile(
@Login long user,
@RequestPart("file") MultipartFile file,
Dto userDto){
@RequestBody를 제거한다. 이후 포스트맨에서 data에 DTO에 맞게 보내던 데이터를 다음 방식으로 변환하였다.
한 번에 보내던 데이터를 키:값 형태로 보내었다.
참조:
'문제해결' 카테고리의 다른 글
pm2 start시 pem 권한 문제 (0) | 2024.06.08 |
---|---|
pm2 had too many unstable restarts(16). stopped. “errored” (0) | 2024.06.08 |
[AWS] EC2 Nginx host not found in upstream ELB (0) | 2023.08.18 |
[SpringBoot] JPA 테이블 또는 필드를 찾지 못할 때 (0) | 2023.08.18 |
[AWS] EC2 Out Of Memory (0) | 2023.08.17 |