Open BastienL opened 7 years ago
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:
application/json
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?
Not a big issue, but when the text starts with "---", the REST API responds with a yaml instead of a JSON:
You got to set the Content-Type to
application/json
to make it return a JSON response:Maybe that should be mentioned in the documentation that setting the appropriate Content-Type is recommended?