MethodNotAllowedErrorclass
new MethodNotAllowedError(message?: string, options?: RequestErrorOptions)
| Param | Type | |
|---|---|---|
message | string | Optional human-readable description of the unsupported method. |
options | RequestErrorOptions | Optional options — code defaults to 405; caller and contextual fields are applied via setBaseErrorOptions(). |
| 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
codeto405.
Examples
throw new MethodNotAllowedError("Use POST not GET");