# Decorator ContentType
Decorator operation response headersModule | import { ContentType } from "@tsed/schema" |
---|---|
Source | /packages/specs/schema/src/types/decorators/operations/contentType.ts |
# Overview
function ContentType(type: string): import("./returns").ReturnsChainedDecorators;
# Description
Sets the Content-Type HTTP header to the MIME type as determined by mime.lookup() for the specified type.
If type contains the “/” character, then it sets the Content-Type
to type.
@ContentType('.html'); // => 'text/html'
@ContentType('html'); // => 'text/html'
@ContentType('json'); // => 'application/json'
@ContentType('application/json'); // => 'application/json'
@ContentType('png'); // => image/png
private myMethod() {}
1
2
3
4
5
6
2
3
4
5
6