UNPKG

1.75 kBTypeScriptView Raw
1import { HttpException, HttpExceptionOptions } from './http.exception';
2/**
3 * Defines an HTTP exception for *Method Not Allowed* type errors.
4 *
5 * @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
6 *
7 * @publicApi
8 */
9export declare class MethodNotAllowedException extends HttpException {
10 /**
11 * Instantiate a `MethodNotAllowedException` Exception.
12 *
13 * @example
14 * `throw new MethodNotAllowedException()`
15 *
16 * @usageNotes
17 * The HTTP response status code will be 405.
18 * - The `objectOrError` argument defines the JSON response body or the message string.
19 * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
20 *
21 * By default, the JSON response body contains two properties:
22 * - `statusCode`: this will be the value 405.
23 * - `message`: the string `'Method Not Allowed'` by default; override this by supplying
24 * a string in the `objectOrError` parameter.
25 *
26 * If the parameter `objectOrError` is a string, the response body will contain an
27 * additional property, `error`, with a short description of the HTTP error. To override the
28 * entire JSON response body, pass an object instead. Nest will serialize the object
29 * and return it as the JSON response body.
30 *
31 * @param objectOrError string or object describing the error condition.
32 * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
33 */
34 constructor(objectOrError?: string | object | any, descriptionOrOptions?: string | HttpExceptionOptions);
35}