본문 바로가기

신나는 오류해결파티!!!

[에러] 422 (Unprocessable Entity)

 

 

상황 : 프로젝트 개발을 위해 api 통신을 하는 중, 해당 에러를 만났다. 

 

 

mdn사이트 설명 

 

 

해석 : 처리할 수 없는 엔터티 응답 상태 코드는 서버가 요청 엔터티의 콘텐츠 유형을 이해하고
요청 엔터티의 구문이 정확하지만 포함된 명령을 처리할 수 없음을 나타냅니다 (구글번역)

 

에러의 원인 :

fetch api를 사용하는 방법을 정확히 알지 못한 것이 원인이었다. 

 

해결방법:

 

headers: {
        "Content-Type": "application/json",
      },

를 fetch의 두번째 객체 안에 추가해 준다.

 

 

느낀점: 

content-type에 대해서 조금 더 공부해야겠다. 

 

 

422에러에 대해 추가 공부한 글 : 

 

[422에러] content-type

출처 : https://www.rfc-editor.org/rfc/rfc4918#section-11.2 RFC 4918: HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV) www.rfc-editor.org The 422 (Unprocessable Entity) status code means the server understands the content type of the

wha-haha.tistory.com