forked from Comcast/plax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp.yaml
67 lines (67 loc) · 1.7 KB
/
http.yaml
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
59
60
61
62
63
64
65
66
67
doc: |
An example of using HTTP client and server channels together.
spec:
phases:
phase1:
steps:
- pub:
doc: Make our HTTP client.
chan: mother
payload:
make:
name: client
type: httpclient
- recv:
chan: mother
pattern:
success: true
- pub:
doc: Make our HTTP server.
chan: mother
payload:
make:
name: server
type: httpserver
config:
host: localhost
port: 8888
parsejson: true
- recv:
chan: mother
pattern:
success: true
- wait: 1s
- pub:
doc: Make an HTTP request to our server.
chan: client
payload:
url: 'http://localhost:8888/order'
method: POST
body:
send: tacos
n: 3
- recv:
doc: Receive the HTTP request from our server.
chan: server
pattern:
path: /order
body:
send: "?this"
n: "?n"
guard: |
return bs["?n"] < 10;
- pub:
doc: Respond to that HTTP request.
chan: server
payload:
body:
deliver: "?this"
n: "?n"
- recv:
doc: Finally get the response from the client.
chan: client
pattern:
statuscode: 200
body:
deliver: tacos
n: 3