-
Notifications
You must be signed in to change notification settings - Fork 503
/
responseHeaderController.ts
58 lines (49 loc) · 1.36 KB
/
responseHeaderController.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { Controller, Get, Route, SuccessResponse, Response, TsoaResponse, Res } from '@tsoa/runtime';
/**
* response header's description
*/
interface ResponseHeader {
/**
* a link string
*/
Link: string;
/**
* b link str[]
*/
LinkB: string[];
/**
* c link string, optional
*/
LinkC?: string;
}
@Route('ResponseHeader')
export class ResponseHeaderController extends Controller {
@Get('SuccessResponseWithHeaderClass')
@SuccessResponse<ResponseHeader>(200, 'zzz')
public async handler(): Promise<void> {
return;
}
@Get('SuccessResponseWithObject')
@SuccessResponse<{ linkA: string; linkB: string[]; linkOpt?: string }>(200, 'xxx')
public async handler2(): Promise<void> {
return;
}
@Get('ResponseWithHeaderClass')
@Response<null, ResponseHeader>(200, 'yyy')
public async handler3(): Promise<void> {
return;
}
@Get('ResponseWithObject')
@Response<null, { linkC: string; linkD: string[]; linkOpt?: string }>(200, 'yyy')
public async handler4(): Promise<void> {
return;
}
@Get('TsoaResponseWithHeaderClass')
public async handler5(@Res() res: TsoaResponse<200, null, ResponseHeader>): Promise<void> {
return;
}
@Get('TsoaResponseWithObject')
public async handler6(@Res() res: TsoaResponse<200, null, { linkE: string; linkF: string[]; linkOpt?: string }>): Promise<void> {
return;
}
}