Skip to content

400 Bad Request always returns plain text #30329

@Mpdreamz

Description

@Mpdreamz

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions