Spring/Issue

[오류 처리] Content type 'text/plain;charset=UTF-8' not supported

블로그 주인장 2023. 10. 24.

Content type 'text/plain;charset=UTF-8' not supported

Spring 프로젝트 진행 시에 Json 에러 관련 조치 내용을 알아보겠습니다.


오류 내용

  • Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain;charset=UTF-8' not supported]

 

오류 원인

컨트롤러는 @RequestParam과 @RequestBody를 사용하여 Json 형식으로 Request를 받고 있는 상황이다.

클라이언트에서 요청 시, Request Header에 'Content-Type' : 'application/json'을 담지 않은 상태에서 발생한 에러이다.

 

오류 해결 방안

클라이언트에서 Request Header에 'Content-Type' : 'text/plain' -> 'Content-Type' : 'application/json' 로 변경한다.

반응형

댓글