MethodNotAllowedError

"405 Method Not Allowed" response error class.

Indicates that the server knows the request method, but the target resource doesn't support this method.

The server must generate an Allow header field in a 405 status code response. The field must contain a list of methods that the target resource currently supports.

Constructor

new MethodNotAllowedError(dataopt)

MethodNotAllowedError constructor

Parameters:
NameTypeAttributesDescription
dataObject | String | ResponseErrorOptions | Options | undefined<optional>

Error message or options

Extends

Members

status

Error status

Examples
404 Not Found
451 Unavailable For Legal Reasons
500 Internal Server Error

Methods

toJSON() → {Object}

Plain object representation of the error

Returns:
Type: 
Object
Example
// returned JSON
{
  error: {
    code: 400,
    requestId: '123456-test-request-id',
    message: 'Baaaaaad Request :-(',
    details: 'Check your request body'
  }
}

toPojo() → {Object}

Plain object representation of the error

Returns:
Type: 
Object
Example
// returned object
{
  error: {
    code: 405,
    requestId: '123456-test-request-id',
    message: 'Method Not Allowed',
    details: 'Check your request body'
  }
}

toString() → {string}

String representation of the error

Returns:
Type: 
string
Example
// returned string
{"error":{"code":400,"requestId":"123456-test-request-id","message":"Baaaaaad Request :-(","details":"Check your request body"}}