Skip to content

Mkcol

reference
1 min readUpdated

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

ts
createMappingDecorator(RequestMethod.MKCOL)

Value

ts
createMappingDecorator(RequestMethod.MKCOL)

Diagram

mermaid
graph LR
  Client[WebDAV Client] -->|MKCOL /collections/new| Router[HTTP Router]
  Router -->|Matches decorated path| Controller[Controller Method]
  Controller -->|@Mkcol()| Handler[Collection Creation Handler]

Usage

ts
import { 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 issue MKCOL requests.
  • Keep authentication, authorization, and error handling consistent with the application's other WebDAV route handlers.

Was this page helpful?

Download as PDF
Mkcol — NestJS head-to-head