본문 바로가기

server/ELK

Elasticsearch {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

5.5.0 이상 버전에서 아래와 같은 에러 발생 시


{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}


curl의 헤더에 content-type을 추가해 줘야 한다. 

-H 'Content-Type: application/json'

ex)


$ curl -XPOST "http://localhost:32769/board/guest"

-H ‘Content-Type: application/json’

-d

'{

  "name": "test",

  "title": "title",

  "content": "content content"

}'