Files
core/test/rust/native/http_pool.dever
T
2026-11-27 06:03:56 +00:00

40 lines
1.8 KiB
Plaintext

flow open(origin: Text, tls: dever.system.ClientTls) (client: dever.system.HttpClient)
| step | kind | do |
| client | flow | dever.http.client(origin, tls, dever.http.defaultLimits(), dever.http.defaultPoolLimits()) |
flow fetch(client: dever.system.HttpClient, body: Bytes) (response: dever.http.Response)
| step | kind | do |
| request | calc | dever.http.Request { method = "POST", target = "/pooled", headers = [], body = body } |
| response | flow | dever.http.request(client, request) |
flow queued(client: dever.system.HttpClient, body: Bytes) (response: dever.http.Response)
| step | kind | do |
| pending | calc | run(fetch(client, body)) |
| response | calc | wait(pending) |
flow close(client: dever.system.HttpClient) ()
| step | kind | do |
| - | flow | dever.http.closeClient(client) |
rule chunkSize(event: dever.io.ReadEvent) (size: Int)
| event | size |
| Chunk(bytes) | length(bytes) |
| Failed(message) | fail(dever.io.ReadEvent.Failed(message)) |
loop consumed(body: AsyncStream<dever.io.ReadEvent>) (size: Int)
| each event in body | result |
| size | sum chunkSize(event) |
flow download(client: dever.system.HttpClient, body: Bytes) (size: Int)
| step | kind | do |
| request | calc | dever.http.Request { method = "POST", target = "/pooled", headers = [], body = body } |
| response | flow | dever.http.open(client, request) |
| size | loop | consumed(response.body) |
flow upload(client: dever.system.HttpClient, bytes: Bytes) (size: Int)
| step | kind | do |
| body | calc | stream([dever.io.ReadEvent.Chunk(bytes)]) |
| request | calc | dever.http.StreamRequest { method = "POST", target = "/pooled", headers = [], body = body } |
| response | flow | dever.http.openStream(client, request) |
| size | loop | consumed(response.body) |