# HeaderParams Decorator operation input
Module | import { HeaderParams } from "@tsed/common" |
---|---|
Source | /packages/common/src/mvc/decorators/params/headerParams.ts |
# Overview
function HeaderParams(expression: string, useType: Type<any>): ParameterDecorator;
export function HeaderParams(expression: string): ParameterDecorator;
export function HeaderParams(useType: Type<any>): ParameterDecorator;
export function HeaderParams(options: IParamOptions<any>): ParameterDecorator;
export function HeaderParams(): ParameterDecorator;
Param | Type | Description |
---|---|---|
expression | string | The path of the property to get. useType |
# Description
HeaderParams return the value from request.params object.
# Example
@Controller('/')
class MyCtrl {
@Get('/')
get(@Header() body: any) {
console.log('Entire body', body);
}
@Get('/')
get(@Header('x-token') token: string) {
console.log('token', id);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
For more information on deserialization see converters page.
- 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