1 | {
|
2 | "daemon": {
|
3 | "test": {
|
4 | "initiator": [ "timer", "repl", "http" ]
|
5 | }
|
6 | },
|
7 | "templates": {
|
8 | "task": {
|
9 | "jsonParseAndMerge": {
|
10 | "$origin": "{$global.JSON}",
|
11 | "$function": "parse",
|
12 | "$mergeWith": "result"
|
13 | },
|
14 | "jsonParseAndSet": {
|
15 | "$origin": "{$global.JSON}",
|
16 | "$function": "parse",
|
17 | "$set": "result"
|
18 | },
|
19 | "indexEqItem": {
|
20 | "$function": "throwUnlessEqual",
|
21 | "$args": [
|
22 | "[*every.index]",
|
23 | "[*every.item]"
|
24 | ]
|
25 | },
|
26 | "testHttpResource": {
|
27 | "$class":"urlData",
|
28 | "$method": "toBuffer"
|
29 | }
|
30 | }
|
31 | },
|
32 | "initiator": {
|
33 | "token": {
|
34 | "flows": "<test/00-anything.json>"
|
35 | },
|
36 | "http": {
|
37 | "port": "<#fixme>",
|
38 | "static": {
|
39 | "root": "example"
|
40 | },
|
41 |
|
42 | "prepare": {
|
43 | "post": {
|
44 | "tasks": [{
|
45 | "$class": "post",
|
46 | "request": "{$request}",
|
47 | "$set": "request.body"
|
48 | }]
|
49 | }
|
50 | },
|
51 | "flows":[{
|
52 | "path": ""
|
53 | }, {
|
54 | "path": "^(\\w+)$",
|
55 | "prepare": ["post"],
|
56 | "tasks": [{
|
57 | "$function": "handleGet",
|
58 | "require": "{$request.GET}"
|
59 | }],
|
60 | "presenter": "json"
|
61 | }, {
|
62 | "path": "test",
|
63 | "flows": [{
|
64 | "path": "redirect",
|
65 | "tasks":[{
|
66 | "$class": "redirect",
|
67 | "url": "/test/redirected",
|
68 | "output": "{$response}"
|
69 | }],
|
70 | "presenter": {
|
71 | "headers": {
|
72 | "Set-Cookie": "auth=123; expires=Fri, 31 Jan 2031 00:00:00 GMT; path=/; domain=<$initiator.http.domain>"
|
73 | }
|
74 | }
|
75 | }, {
|
76 | "path": "timeout",
|
77 | "data": {
|
78 | "empty response": true
|
79 | },
|
80 | "tasks":[{
|
81 | "$class": "sleep",
|
82 | "amount": 4000
|
83 | }],
|
84 | "presenter": {
|
85 | "type": "json",
|
86 | "dump": true
|
87 | }
|
88 | }, {
|
89 | "path": "redirected",
|
90 | "presenter": {
|
91 | "type": "json",
|
92 | "vars": "{$request.headers}",
|
93 | "verbose": true
|
94 | }
|
95 | }, {
|
96 | "path": "post",
|
97 | "prepare": ["post"],
|
98 | "tasks": [{
|
99 | "$function": "handleGet",
|
100 | "require": "{$request.POST}"
|
101 | }],
|
102 | "presenter": {
|
103 | "type": "json",
|
104 | "vars": "{$request.body}"
|
105 | }
|
106 |
|
107 | }]
|
108 | }]
|
109 | },
|
110 | "timer": {
|
111 | "flows": []
|
112 | }
|
113 | }
|
114 | }
|