elasticsearch-langdetect
elasticsearch-langdetect copied to clipboard
REST API returns an application/yaml response
Not a big issue, but when the text starts with "---", the REST API responds with a yaml instead of a JSON:
curl -XPOST 'localhost:9200/_langdetect?pretty' -d '---This is a test' -i
HTTP/1.1 200 OK
Content-Type: application/yaml
Content-Length: 90
---
profile: "/langdetect/"
languages:
- language: "en"
probability: 0.9999972283490304
You got to set the Content-Type to application/json
to make it return a JSON response:
curl -XPOST 'localhost:9200/_langdetect?pretty' -d '---This is a test' -i -H "Content-Type: application/json"
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 122
{
"profile" : "/langdetect/",
"languages" : [ {
"language" : "en",
"probability" : 0.9999972283490304
} ]
}
Maybe that should be mentioned in the documentation that setting the appropriate Content-Type is recommended?