Kind: Constant
Source: packages/common/decorators/http/request-mapping.decorator.ts
Part of: Common
Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
Mkcol is a route handler decorator that maps an HTTP WebDAV MKCOL request to a controller method. Use it to define endpoints responsible for creating WebDAV collections (directory-like resources) at a specified path.
Definition
tscreateMappingDecorator(RequestMethod.MKCOL)
Value
tscreateMappingDecorator(RequestMethod.MKCOL)
Diagram
mermaidgraph LR Client[WebDAV Client] -->|MKCOL /collections/new| Router[HTTP Router] Router -->|Matches decorated path| Controller[Controller Method] Controller -->|@Mkcol()| Handler[Collection Creation Handler]
Usage
tsimport { Controller } from '@nestjs/common';
import { Mkcol } from '@common/decorators/http/request-mapping.decorator';
@Controller('webdav')
export class WebdavController {
@Mkcol('collections/:name')
createCollection() {
return {
status: 'Collection created',
};
}
}
AI Coding Instructions
- Apply
@Mkcol()only to controller methods that handle WebDAV collection creation requests. - Provide a path relative to the controller prefix, following the same route conventions as other request-mapping decorators.
- Ensure the handler implements appropriate WebDAV semantics, including validation for existing collections and parent resources.
- Do not use standard
@Post()as a substitute when WebDAV clients specifically issueMKCOLrequests. - Keep authentication, authorization, and error handling consistent with the application's other WebDAV route handlers.
Was this page helpful?