Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 Bad Request always returns plain text #30329

Closed
Mpdreamz opened this issue May 2, 2018 · 2 comments

Comments

Projects
None yet
5 participants
@Mpdreamz
Copy link
Member

commented May 2, 2018

On a cluster with no x-pack and version 6.2.4:

POST http://127.0.0.1:9200/_xpack/migration/upgrade/.watches HTTP/1.1
Connection: Keep-Alive
Accept: application/json
Content-Length: 0
Host: 127.0.0.1:9200
HTTP/1.1 400 Bad Request
content-type: text/plain; charset=UTF-8
content-length: 79

No handler found for uri [/_xpack/migration/upgrade/.watches] and method [POST]

Ideally it returns application/json as requested by the Accept header. This is how we currently return 405 and 406

POST http://127.0.0.1:9200/_blah HTTP/1.1
Connection: Keep-Alive
Accept: application/json
Content-Length: 0
Host: 127.0.0.1:9200
{"error":"Incorrect HTTP method for uri [/_blah] and method [POST], allowed: [HEAD, DELETE, PUT, GET]","status":405}

One could also argue it should not be a 400 but a 404 if the resource does not exist:

GET http://127.0.0.1:9200/_nodes/safdasd/asdasd/sadasd HTTP/1.1
Connection: Keep-Alive
Accept: application/json
Content-Length: 0
Host: 127.0.0.1:9200
No handler found for uri [/_nodes/safdasd/asdasd/sadasd] and method [GET]
@ashishguptak

This comment has been minimized.

Copy link

commented May 3, 2018

Can I pick up this bug? Any inputs will be appreciated.

@elasticmachine

This comment has been minimized.

Copy link
Collaborator

commented May 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.