MCPcopy Index your code
hub / github.com/ParallelTask/dinoloop / TestController

Class TestController

tests/integration/attributes.spec.ts:16–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14import { initializeTests } from './init';
15
16@Controller('/test')
17class TestController extends ApiController {
18
19 @HttpGet('/get')
20 get(): any {
21 return { data: 'Get' };
22 }
23
24 @HttpGet('/getWithoutData')
25 getWithoutDate(): void {
26 return;
27 }
28
29 @HttpGet(/^\d+$/)
30 acceptsNumbers(): any {
31 return { data: 'Numbers' };
32 }
33
34 @HttpPost('/post')
35 post(): any {
36 return { data: 'Post' };
37 }
38
39 @HttpHead('/head')
40 head(): any {
41 return { data: 'Head' };
42 }
43
44 @HttpDelete('/delete')
45 del(): any {
46 return { data: 'Delete' };
47 }
48
49 @HttpGet('/both')
50 @HttpPost('/both')
51 both(): any {
52 return { data: 'Both' };
53 }
54
55 @SendsResponse()
56 @HttpGet('/sendsResponse')
57 sendsResp(): void {
58 setTimeout(() => {
59 this.response.status(200)
60 .json({ data: 'SendsResponse' });
61 }, 2);
62 }
63
64 @Async()
65 @HttpGet('/async')
66 async getAsync(): Promise<any> {
67 return await Deferrer.run<any>((res, rej) => {
68 setTimeout(() => {
69 res({ data: 'Async' });
70 }, 2);
71 });
72 }
73}

Callers

nothing calls this directly

Calls 7

ControllerFunction · 0.85
HttpGetFunction · 0.85
HttpPostFunction · 0.85
HttpHeadFunction · 0.85
HttpDeleteFunction · 0.85
SendsResponseFunction · 0.85
AsyncFunction · 0.85

Tested by

no test coverage detected