# ContentType Decorator operation response headers
Module | import { ContentType } from "@tsed/common" |
---|---|
Source | /packages/common/src/mvc/decorators/method/contentType.ts |
# Overview
function ContentType(type: string): any;
# 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
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing