MethodNotAllowedErrorclass

new MethodNotAllowedError(message?: string, options?: RequestErrorOptions)
ParamType
messagestring
Optional human-readable description of the unsupported method.
optionsRequestErrorOptions
Return
MethodNotAllowedError
Throw if a request uses an HTTP method that is not supported.

Throw if a request uses an HTTP method that is not supported.

  • Sets HTTP status code to 405.

Examples

throw new MethodNotAllowedError("Use POST not GET");