1. HTTP (Hypertext Transfer Protocol)

  1. HTTP Status Codes

  1. 400 Bad Request
    1. Writing responses (servers)
    2. Reading responses (clients)
    3. Overview table
    4. Implementations
      1. Node.js (http/https)
    5. See also

400 Bad Request

The 400 (Bad Request) HTTP status code indicates the server cannot fill the request because of an error in the request, as perceived by the server.

Writing responses (servers)

Use 400 (Bad Request) for errors in the request, where there is not a more specific status code available. Consult the IANA HTTP Status Code Registry to determine if a more appropriate status code is available. If the error is correctable at the server (for example, an uncaught exception, or a status requiring administrator intervention), then see 500 Server Error.

Try to return a short response body that describes the error.

If the error is due to invalid syntax that prevents further parsing, also close the connection.

Reading responses (clients)

400 errors typically cannot be retried without some sort of adjustment. However, without a more specific error code, a user must intervene and troubleshoot the problem with the request.

Overview table

Name
400
Message
400 Bad Request
Description
The resource does not permit the requested method.
Specification
RFC 7231: HTTP/1.1 Semantics and Content ยง6.5.5. 400 Bad Request

Implementations

Node.js (http/https)

Node.js automatically returns 400 Bad Request in the following circumstances:

See also