Skip to content

Commit effb0a2

Browse files
Improved chunk serialization and debug request/repsonse body.
1 parent a580b9f commit effb0a2

13 files changed

+620
-124
lines changed

async-http-capture.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
2222
spec.required_ruby_version = ">= 3.2"
2323

2424
spec.add_dependency "async-http", "~> 0.90"
25-
spec.add_dependency "base64"
25+
spec.add_dependency "protocol-http", ">= 0.53.0"
2626
end

examples/recorder/cassette/recordings/20250821-105006-257022-fbbb5beb8add436b.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

examples/recorder/cassette/recordings/20250821-105406-271633-4b51df4bdd5089b1.json

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"debug": {
3+
"response_body": {
4+
"class": "Protocol::HTTP::Body::Completable",
5+
"body": {
6+
"class": "Protocol::HTTP::Body::Rewindable",
7+
"body": {
8+
"class": "Protocol::HTTP::Body::Deflate",
9+
"body": {
10+
"class": "Protocol::Rack::Body::Enumerable",
11+
"length": 86,
12+
"stream": false,
13+
"ready": true,
14+
"empty": false
15+
},
16+
"input_length": 86,
17+
"output_length": 108,
18+
"compression_ratio": 125.58
19+
},
20+
"index": 2,
21+
"chunks": 2
22+
},
23+
"callback": "#<Proc:0x000000011e5aaa40 /Users/samuel/Developer/socketry/async-http-record/lib/async/http/capture/middleware.rb:107>"
24+
}
25+
},
26+
"request": {
27+
"scheme": "http",
28+
"authority": "localhost:9292",
29+
"method": "GET",
30+
"path": "/json",
31+
"version": "HTTP/1.1",
32+
"protocol": null,
33+
"headers": {
34+
"fields": [
35+
[
36+
"Connection",
37+
"keep-alive"
38+
],
39+
[
40+
"sec-ch-ua",
41+
"\"Not;A=Brand\";v=\"99\", \"Google Chrome\";v=\"139\", \"Chromium\";v=\"139\""
42+
],
43+
[
44+
"sec-ch-ua-mobile",
45+
"?0"
46+
],
47+
[
48+
"sec-ch-ua-platform",
49+
"\"macOS\""
50+
],
51+
[
52+
"Upgrade-Insecure-Requests",
53+
"1"
54+
],
55+
[
56+
"User-Agent",
57+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
58+
],
59+
[
60+
"Accept",
61+
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
62+
],
63+
[
64+
"Sec-Fetch-Site",
65+
"same-origin"
66+
],
67+
[
68+
"Sec-Fetch-Mode",
69+
"navigate"
70+
],
71+
[
72+
"Sec-Fetch-User",
73+
"?1"
74+
],
75+
[
76+
"Sec-Fetch-Dest",
77+
"document"
78+
],
79+
[
80+
"Referer",
81+
"http://localhost:9292/"
82+
],
83+
[
84+
"Accept-Encoding",
85+
"gzip, deflate, br, zstd"
86+
],
87+
[
88+
"Accept-Language",
89+
"en-US,en;q=0.9"
90+
]
91+
],
92+
"tail": null
93+
}
94+
},
95+
"response": {
96+
"version": null,
97+
"status": 200,
98+
"protocol": null,
99+
"headers": {
100+
"fields": [
101+
[
102+
"content-type",
103+
"application/json"
104+
],
105+
[
106+
"vary",
107+
"accept-encoding"
108+
],
109+
[
110+
"content-encoding",
111+
"gzip"
112+
]
113+
],
114+
"tail": 3
115+
},
116+
"body": [
117+
"H4sIAAAAAAAAE6pWyk0tLk5MT1WyUvJIzcnJV0grys9V8Ar291NwDPBU0lEqyQSqKEnMLQCqMDIwMtU1sNA1MgwxMrACImNzbUMjKwMDoLqixLyU/FwlK0Mzi1oAAAAA//8=",
118+
"AwAfPvbWVgAAAA=="
119+
]
120+
}
121+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"debug": {
3+
"response_body": {
4+
"class": "Protocol::HTTP::Body::Completable",
5+
"body": {
6+
"class": "Protocol::HTTP::Body::Rewindable",
7+
"body": {
8+
"class": "Protocol::HTTP::Body::Deflate",
9+
"body": {
10+
"class": "Protocol::Rack::Body::Enumerable",
11+
"length": 901,
12+
"stream": false,
13+
"ready": true,
14+
"empty": false
15+
},
16+
"input_length": 901,
17+
"output_length": 523,
18+
"compression_ratio": 58.05
19+
},
20+
"index": 2,
21+
"chunks": 2
22+
},
23+
"callback": "#<Proc:0x000000011e5a0a68 /Users/samuel/Developer/socketry/async-http-record/lib/async/http/capture/middleware.rb:107>"
24+
}
25+
},
26+
"request": {
27+
"scheme": "http",
28+
"authority": "localhost:9292",
29+
"method": "GET",
30+
"path": "/headers",
31+
"version": "HTTP/1.1",
32+
"protocol": null,
33+
"headers": {
34+
"fields": [
35+
[
36+
"Connection",
37+
"keep-alive"
38+
],
39+
[
40+
"sec-ch-ua",
41+
"\"Not;A=Brand\";v=\"99\", \"Google Chrome\";v=\"139\", \"Chromium\";v=\"139\""
42+
],
43+
[
44+
"sec-ch-ua-mobile",
45+
"?0"
46+
],
47+
[
48+
"sec-ch-ua-platform",
49+
"\"macOS\""
50+
],
51+
[
52+
"Upgrade-Insecure-Requests",
53+
"1"
54+
],
55+
[
56+
"User-Agent",
57+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
58+
],
59+
[
60+
"Accept",
61+
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
62+
],
63+
[
64+
"Sec-Fetch-Site",
65+
"same-origin"
66+
],
67+
[
68+
"Sec-Fetch-Mode",
69+
"navigate"
70+
],
71+
[
72+
"Sec-Fetch-User",
73+
"?1"
74+
],
75+
[
76+
"Sec-Fetch-Dest",
77+
"document"
78+
],
79+
[
80+
"Referer",
81+
"http://localhost:9292/"
82+
],
83+
[
84+
"Accept-Encoding",
85+
"gzip, deflate, br, zstd"
86+
],
87+
[
88+
"Accept-Language",
89+
"en-US,en;q=0.9"
90+
]
91+
],
92+
"tail": null
93+
}
94+
},
95+
"response": {
96+
"version": null,
97+
"status": 200,
98+
"protocol": null,
99+
"headers": {
100+
"fields": [
101+
[
102+
"content-type",
103+
"application/json"
104+
],
105+
[
106+
"vary",
107+
"accept-encoding"
108+
],
109+
[
110+
"content-encoding",
111+
"gzip"
112+
]
113+
],
114+
"tail": 3
115+
},
116+
"body": [
117+
"H4sIAAAAAAAAE2RS0W7aMBR971dYfmq7mEARY4DQxFhHq5a2aoq2B6TKOBfbwrFTxzBG1X+fnYStFOXFPudc33vPyesJQjgDJ0yK+whPLp9wFKCcOhGAWABNwRYV+rIG+yfA1XXP9dGrv3pgbLQG5qTRQbQCyAlVcgOl3PMJMDIWZEYDPcd3xg1Gw2+W6nSOB5vhHPd6cxyhOZ4YwxWgsbAmg5prtWuyROU6e48fdSBTs5AKQqOvzWP2QVG3NDarBskou0/+PzLLufWbkWtdAFtbII/gNy9c2BS3/qkKsGTEQbsAT81OKkXjTqOJTqeUSe1MIQboWjtQyAPoPkG/UKv53Oo8d8/QKM8V/ITFjXRxp91ttD+j05urp+lthJRcAZoAW5mz2oHY79hohg8ldEmtrEv2o4wYg7wcw8HWxcJlKqK+gWQ0hBFvA/Jp+xHN1OBl2Gz0IplRDjHdyGV9/A2LfI/mmkfn8Xkp/XLwQCG5hpTAlgmqOfg0Fu1S1n1v+A9wTJBEujKMgmZAjJVc6mPR1KSlSPtROHVwrAiml5m2jrnvPqLApYatsxBLrXiEJdiqTDiX9+NYGUaVMIXr9y56F/GhjeRSM5NKzUMB38k8Qiks/f8CEVrYCO0Kl36ouPXrr71ZoQI0mSUR6MravfDKVLMddsaefDt5+wsAAP//",
118+
"AwA30UbShQMAAA=="
119+
]
120+
}
121+
}

0 commit comments

Comments
 (0)