25 lines
1.2 KiB
Plaintext
25 lines
1.2 KiB
Plaintext
request(body: Bytes) (out: dever.http.Request) {
|
|
out = dever.http.Request { method = "POST", target = "/echo?q=1", headers = [dever.http.header("Host", "localhost")], body = body }
|
|
}
|
|
|
|
records() (out: Bool) {
|
|
original = request(dever.bytes.fromText("value"))
|
|
changed = original
|
|
changed.target = "/changed"
|
|
header = dever.http.header("X-Name", "one")
|
|
renamed = header
|
|
renamed.name = "X-Other"
|
|
found = dever.http.headerValue([header, dever.http.header("x-name", "two")], "X-NAME")
|
|
missing = dever.http.headerValue([header], "absent")
|
|
out = original.target == "/echo?q=1" and changed.target == "/changed" and original.body == changed.body and header.name == "X-Name" and renamed.name == "X-Other" and original != changed and found == dever.bytes.fromText("one") and missing == null
|
|
}
|
|
|
|
flow fetch(address: Text, port: Int, body: Bytes) (response: dever.http.Response)
|
|
| step | kind | do |
|
|
| response | flow | dever.http.send(address, port, request(body), dever.http.defaultLimits()) |
|
|
|
|
flow scheduled(address: Text, port: Int, body: Bytes) (response: dever.http.Response)
|
|
| step | kind | do |
|
|
| pending | calc | run(fetch(address, port, body)) |
|
|
| response | calc | wait(pending) |
|