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
Closed

400 Bad Request always returns plain text #30329

Mpdreamz opened this issue May 2, 2018 · 2 comments
Labels
>bug :Core/Infra/REST API REST infrastructure and utilities

Comments

@Mpdreamz
Copy link
Member

Mpdreamz 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]
@colings86 colings86 added >bug :Core/Infra/REST API REST infrastructure and utilities labels May 2, 2018
@ashishguptak
Copy link

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

@hub-cap hub-cap added :Core/Infra/REST API REST infrastructure and utilities and removed :Core/Infra/REST API REST infrastructure and utilities labels May 3, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/REST API REST infrastructure and utilities
Projects
None yet
Development

No branches or pull requests

5 participants