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

Class TestController

tests/integration/query.param.spec.ts:16–59  ·  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 @HttpGet('/toBoolean')
19 toBoolean(@QueryParam(toBoolean) val: boolean): any {
20 return { data: val };
21 }
22 @HttpGet('/toInteger')
23 toInteger(@QueryParam(toInteger) val: number): any {
24 return { data: val };
25 }
26 @HttpGet('/toNumber')
27 toNumber(@QueryParam(toNumber) val: number): any {
28 return { data: val };
29 }
30 // Verify without handler
31 @HttpGet('/query')
32 query(@QueryParam() search: string): any {
33 return { data: search };
34 }
35 // Verify with, without parse and with, without handler in query-param
36 @HttpGet('/:user/:id')
37 userImg(
38 @Parse(toNumber) id: number,
39 user: string,
40 @QueryParam() price: string,
41 @QueryParam(toBoolean) old: boolean): any {
42 return { id: id, user: user, price: price, old: old };
43 }
44 @HttpPost('/add/:user/:id')
45 addParse(
46 @Parse(() => 'test_body') body: any,
47 @Parse(() => 'test_user') user: string,
48 id: string,
49 @QueryParam() price: string,
50 @QueryParam(toBoolean) old: boolean): any {
51 return {
52 body: body,
53 user: user,
54 id: id,
55 price: price,
56 old: old
57 };
58 }
59}
60describe('query.param.e2e.spec', () => {
61 const baseRoute = '/api/test';
62

Callers

nothing calls this directly

Calls 3

ControllerFunction · 0.85
HttpGetFunction · 0.85
HttpPostFunction · 0.85

Tested by

no test coverage detected