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

Class TestController

tests/integration/segments.spec.ts:11–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9import { initializeTests } from './init';
10
11@Controller('/test')
12class TestController extends ApiController {
13
14 @HttpGet('/:id')
15 get(id: string): any {
16 return { data: id };
17 }
18
19 @HttpGet('/:user/images/:img')
20 getImg(img: string, user: string): any {
21 return { img: img, user: user };
22 }
23
24 @HttpPost('/post')
25 post(body: any): any {
26 return body;
27 }
28
29 @HttpPost('/add/:id')
30 add(body: any, id: string): any {
31 return { body: body, id: id };
32 }
33
34 @HttpGet('/optional/:id?')
35 optional(id: string): any {
36 // reason to return "undefined"
37 // because json stringify will remove elements
38 // which are undefined
39 if (id === undefined) return { data: 'undefined' };
40
41 return { data: id };
42 }
43}
44
45describe('segments.e2e.spec', () => {
46 const baseRoute = '/api/test';

Callers

nothing calls this directly

Calls 3

ControllerFunction · 0.85
HttpGetFunction · 0.85
HttpPostFunction · 0.85

Tested by

no test coverage detected