spikard 0.6.2 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +90 -508
  3. data/ext/spikard_rb/Cargo.lock +3287 -0
  4. data/ext/spikard_rb/Cargo.toml +1 -1
  5. data/ext/spikard_rb/extconf.rb +3 -3
  6. data/lib/spikard/app.rb +72 -49
  7. data/lib/spikard/background.rb +38 -7
  8. data/lib/spikard/testing.rb +42 -4
  9. data/lib/spikard/version.rb +1 -1
  10. data/sig/spikard.rbs +4 -0
  11. data/vendor/crates/spikard-bindings-shared/Cargo.toml +1 -1
  12. data/vendor/crates/spikard-bindings-shared/tests/config_extractor_behavior.rs +191 -0
  13. data/vendor/crates/spikard-core/Cargo.toml +1 -1
  14. data/vendor/crates/spikard-core/src/http.rs +1 -0
  15. data/vendor/crates/spikard-core/src/lifecycle.rs +63 -0
  16. data/vendor/crates/spikard-core/tests/bindings_response_tests.rs +136 -0
  17. data/vendor/crates/spikard-core/tests/di_dependency_defaults.rs +37 -0
  18. data/vendor/crates/spikard-core/tests/error_mapper.rs +761 -0
  19. data/vendor/crates/spikard-core/tests/parameters_edge_cases.rs +106 -0
  20. data/vendor/crates/spikard-core/tests/parameters_full.rs +701 -0
  21. data/vendor/crates/spikard-core/tests/parameters_schema_and_formats.rs +301 -0
  22. data/vendor/crates/spikard-core/tests/request_data_roundtrip.rs +67 -0
  23. data/vendor/crates/spikard-core/tests/validation_coverage.rs +250 -0
  24. data/vendor/crates/spikard-core/tests/validation_error_paths.rs +45 -0
  25. data/vendor/crates/spikard-http/Cargo.toml +1 -1
  26. data/vendor/crates/spikard-http/src/jsonrpc/http_handler.rs +502 -0
  27. data/vendor/crates/spikard-http/src/jsonrpc/method_registry.rs +648 -0
  28. data/vendor/crates/spikard-http/src/jsonrpc/mod.rs +58 -0
  29. data/vendor/crates/spikard-http/src/jsonrpc/protocol.rs +1207 -0
  30. data/vendor/crates/spikard-http/src/jsonrpc/router.rs +2262 -0
  31. data/vendor/crates/spikard-http/src/testing/test_client.rs +155 -2
  32. data/vendor/crates/spikard-http/src/testing.rs +171 -0
  33. data/vendor/crates/spikard-http/src/websocket.rs +79 -6
  34. data/vendor/crates/spikard-http/tests/auth_integration.rs +647 -0
  35. data/vendor/crates/spikard-http/tests/common/test_builders.rs +633 -0
  36. data/vendor/crates/spikard-http/tests/di_handler_error_responses.rs +162 -0
  37. data/vendor/crates/spikard-http/tests/middleware_stack_integration.rs +389 -0
  38. data/vendor/crates/spikard-http/tests/request_extraction_full.rs +513 -0
  39. data/vendor/crates/spikard-http/tests/server_auth_middleware_behavior.rs +244 -0
  40. data/vendor/crates/spikard-http/tests/server_configured_router_behavior.rs +200 -0
  41. data/vendor/crates/spikard-http/tests/server_cors_preflight.rs +82 -0
  42. data/vendor/crates/spikard-http/tests/server_handler_wrappers.rs +464 -0
  43. data/vendor/crates/spikard-http/tests/server_method_router_additional_behavior.rs +286 -0
  44. data/vendor/crates/spikard-http/tests/server_method_router_coverage.rs +118 -0
  45. data/vendor/crates/spikard-http/tests/server_middleware_behavior.rs +99 -0
  46. data/vendor/crates/spikard-http/tests/server_middleware_branches.rs +206 -0
  47. data/vendor/crates/spikard-http/tests/server_openapi_jsonrpc_static.rs +281 -0
  48. data/vendor/crates/spikard-http/tests/server_router_behavior.rs +121 -0
  49. data/vendor/crates/spikard-http/tests/sse_full_behavior.rs +584 -0
  50. data/vendor/crates/spikard-http/tests/sse_handler_behavior.rs +130 -0
  51. data/vendor/crates/spikard-http/tests/test_client_requests.rs +167 -0
  52. data/vendor/crates/spikard-http/tests/testing_helpers.rs +87 -0
  53. data/vendor/crates/spikard-http/tests/testing_module_coverage.rs +156 -0
  54. data/vendor/crates/spikard-http/tests/urlencoded_content_type.rs +82 -0
  55. data/vendor/crates/spikard-http/tests/websocket_full_behavior.rs +440 -0
  56. data/vendor/crates/spikard-http/tests/websocket_integration.rs +152 -0
  57. data/vendor/crates/spikard-rb/Cargo.toml +1 -1
  58. data/vendor/crates/spikard-rb/src/gvl.rs +80 -0
  59. data/vendor/crates/spikard-rb/src/handler.rs +12 -9
  60. data/vendor/crates/spikard-rb/src/lib.rs +137 -124
  61. data/vendor/crates/spikard-rb/src/request.rs +342 -0
  62. data/vendor/crates/spikard-rb/src/runtime/server_runner.rs +1 -8
  63. data/vendor/crates/spikard-rb/src/server.rs +1 -8
  64. data/vendor/crates/spikard-rb/src/testing/client.rs +168 -9
  65. data/vendor/crates/spikard-rb/src/websocket.rs +119 -30
  66. data/vendor/crates/spikard-rb-macros/Cargo.toml +14 -0
  67. data/vendor/crates/spikard-rb-macros/src/lib.rs +52 -0
  68. metadata +44 -1
@@ -0,0 +1,286 @@
1
+ use axum::body::Body;
2
+ use axum::http::{Request, StatusCode};
3
+ use http_body_util::BodyExt;
4
+ use serde_json::json;
5
+ use spikard_http::server::build_router_with_handlers_and_config;
6
+ use spikard_http::{Handler, HandlerResult, Method, RequestData, Route, ServerConfig, StaticFilesConfig};
7
+ use std::future::Future;
8
+ use std::pin::Pin;
9
+ use std::sync::Arc;
10
+ use std::time::Duration;
11
+ use tempfile::tempdir;
12
+ use tokio::time::sleep;
13
+ use tower::ServiceExt;
14
+
15
+ struct EchoRequestDataHandler;
16
+
17
+ impl Handler for EchoRequestDataHandler {
18
+ fn call(
19
+ &self,
20
+ _request: Request<Body>,
21
+ request_data: RequestData,
22
+ ) -> Pin<Box<dyn Future<Output = HandlerResult> + Send + '_>> {
23
+ Box::pin(async move {
24
+ let payload = json!({
25
+ "method": request_data.method,
26
+ "path": request_data.path,
27
+ "path_params": request_data.path_params.as_ref(),
28
+ "query_params": request_data.query_params,
29
+ "body": request_data.body,
30
+ });
31
+ let bytes = serde_json::to_vec(&payload).expect("serialize");
32
+ Ok(axum::http::Response::builder()
33
+ .status(StatusCode::OK)
34
+ .header("content-type", "application/json")
35
+ .body(Body::from(bytes))
36
+ .expect("response"))
37
+ })
38
+ }
39
+ }
40
+
41
+ struct SlowHandler {
42
+ sleep_for: Duration,
43
+ }
44
+
45
+ impl Handler for SlowHandler {
46
+ fn call(
47
+ &self,
48
+ _request: Request<Body>,
49
+ _request_data: RequestData,
50
+ ) -> Pin<Box<dyn Future<Output = HandlerResult> + Send + '_>> {
51
+ let duration = self.sleep_for;
52
+ Box::pin(async move {
53
+ sleep(duration).await;
54
+ Ok(axum::http::Response::builder()
55
+ .status(StatusCode::OK)
56
+ .body(Body::from("ok"))
57
+ .expect("response"))
58
+ })
59
+ }
60
+ }
61
+
62
+ fn route(method: Method, path: &str, handler_name: &str) -> Route {
63
+ Route {
64
+ method,
65
+ path: path.to_string(),
66
+ handler_name: handler_name.to_string(),
67
+ expects_json_body: true,
68
+ cors: None,
69
+ is_async: true,
70
+ file_params: None,
71
+ request_validator: None,
72
+ response_validator: None,
73
+ parameter_validator: None,
74
+ jsonrpc_method: None,
75
+ #[cfg(feature = "di")]
76
+ handler_dependencies: Vec::new(),
77
+ }
78
+ }
79
+
80
+ async fn json_response(router: axum::Router, request: Request<Body>) -> serde_json::Value {
81
+ let response = router.oneshot(request).await.expect("response");
82
+ assert_eq!(response.status(), StatusCode::OK);
83
+ let bytes = response.into_body().collect().await.expect("collect body").to_bytes();
84
+ serde_json::from_slice(&bytes).expect("json")
85
+ }
86
+
87
+ #[tokio::test]
88
+ async fn put_with_path_params_and_json_body_is_extracted() {
89
+ let router = build_router_with_handlers_and_config(
90
+ vec![(
91
+ route(Method::Put, "/items/{id}", "echo"),
92
+ Arc::new(EchoRequestDataHandler) as Arc<dyn Handler>,
93
+ )],
94
+ ServerConfig::default(),
95
+ Vec::new(),
96
+ )
97
+ .expect("router");
98
+
99
+ let payload = json!({"name":"widget"});
100
+ let request = Request::builder()
101
+ .method("PUT")
102
+ .uri("/items/123")
103
+ .header("content-type", "application/json")
104
+ .body(Body::from(serde_json::to_vec(&payload).expect("encode")))
105
+ .expect("request");
106
+
107
+ let body = json_response(router, request).await;
108
+ assert_eq!(body["method"], "PUT");
109
+ assert_eq!(body["path"], "/items/123");
110
+ assert_eq!(body["path_params"]["id"], "123");
111
+ assert_eq!(body["body"]["name"], "widget");
112
+ }
113
+
114
+ #[tokio::test]
115
+ async fn patch_with_path_params_and_json_body_is_extracted() {
116
+ let router = build_router_with_handlers_and_config(
117
+ vec![(
118
+ route(Method::Patch, "/items/{id}", "echo"),
119
+ Arc::new(EchoRequestDataHandler) as Arc<dyn Handler>,
120
+ )],
121
+ ServerConfig::default(),
122
+ Vec::new(),
123
+ )
124
+ .expect("router");
125
+
126
+ let payload = json!({"active":true});
127
+ let request = Request::builder()
128
+ .method("PATCH")
129
+ .uri("/items/777")
130
+ .header("content-type", "application/json")
131
+ .body(Body::from(serde_json::to_vec(&payload).expect("encode")))
132
+ .expect("request");
133
+
134
+ let body = json_response(router, request).await;
135
+ assert_eq!(body["method"], "PATCH");
136
+ assert_eq!(body["path_params"]["id"], "777");
137
+ assert_eq!(body["body"]["active"], true);
138
+ }
139
+
140
+ #[tokio::test]
141
+ async fn head_with_path_params_hits_handler() {
142
+ let router = build_router_with_handlers_and_config(
143
+ vec![(
144
+ route(Method::Head, "/health/{id}", "echo"),
145
+ Arc::new(EchoRequestDataHandler) as Arc<dyn Handler>,
146
+ )],
147
+ ServerConfig::default(),
148
+ Vec::new(),
149
+ )
150
+ .expect("router");
151
+
152
+ let request = Request::builder()
153
+ .method("HEAD")
154
+ .uri("/health/abc")
155
+ .body(Body::empty())
156
+ .expect("request");
157
+
158
+ let response = router.oneshot(request).await.expect("response");
159
+ assert_eq!(response.status(), StatusCode::OK);
160
+ assert_eq!(
161
+ response.headers().get("content-type").and_then(|h| h.to_str().ok()),
162
+ Some("application/json")
163
+ );
164
+ let bytes = response.into_body().collect().await.expect("collect body").to_bytes();
165
+ assert!(bytes.is_empty());
166
+ }
167
+
168
+ #[tokio::test]
169
+ async fn trace_with_path_params_hits_handler() {
170
+ let router = build_router_with_handlers_and_config(
171
+ vec![(
172
+ route(Method::Trace, "/trace/{id}", "echo"),
173
+ Arc::new(EchoRequestDataHandler) as Arc<dyn Handler>,
174
+ )],
175
+ ServerConfig::default(),
176
+ Vec::new(),
177
+ )
178
+ .expect("router");
179
+
180
+ let request = Request::builder()
181
+ .method("TRACE")
182
+ .uri("/trace/xyz")
183
+ .body(Body::empty())
184
+ .expect("request");
185
+
186
+ let body = json_response(router, request).await;
187
+ assert_eq!(body["method"], "TRACE");
188
+ assert_eq!(body["path_params"]["id"], "xyz");
189
+ }
190
+
191
+ #[tokio::test]
192
+ async fn options_with_path_params_hits_handler_when_no_cors_configured() {
193
+ let router = build_router_with_handlers_and_config(
194
+ vec![(
195
+ route(Method::Options, "/options/{id}", "echo"),
196
+ Arc::new(EchoRequestDataHandler) as Arc<dyn Handler>,
197
+ )],
198
+ ServerConfig::default(),
199
+ Vec::new(),
200
+ )
201
+ .expect("router");
202
+
203
+ let request = Request::builder()
204
+ .method("OPTIONS")
205
+ .uri("/options/1")
206
+ .body(Body::empty())
207
+ .expect("request");
208
+
209
+ let body = json_response(router, request).await;
210
+ assert_eq!(body["method"], "OPTIONS");
211
+ assert_eq!(body["path_params"]["id"], "1");
212
+ }
213
+
214
+ #[tokio::test]
215
+ async fn request_timeout_returns_408() {
216
+ let config = ServerConfig {
217
+ request_timeout: Some(1),
218
+ ..Default::default()
219
+ };
220
+
221
+ let router = build_router_with_handlers_and_config(
222
+ vec![(
223
+ route(Method::Get, "/slow", "slow"),
224
+ Arc::new(SlowHandler {
225
+ sleep_for: Duration::from_secs(2),
226
+ }) as Arc<dyn Handler>,
227
+ )],
228
+ config,
229
+ Vec::new(),
230
+ )
231
+ .expect("router");
232
+
233
+ let response = router
234
+ .oneshot(
235
+ Request::builder()
236
+ .method("GET")
237
+ .uri("/slow")
238
+ .body(Body::empty())
239
+ .expect("request"),
240
+ )
241
+ .await
242
+ .expect("response");
243
+
244
+ assert_eq!(response.status(), StatusCode::REQUEST_TIMEOUT);
245
+ }
246
+
247
+ #[tokio::test]
248
+ async fn static_files_cache_control_header_is_set_when_configured() {
249
+ let dir = tempdir().expect("temp dir");
250
+ let file_path = dir.path().join("hello.txt");
251
+ std::fs::write(&file_path, "hi").expect("write file");
252
+
253
+ let config = ServerConfig {
254
+ static_files: vec![StaticFilesConfig {
255
+ directory: dir.path().to_string_lossy().to_string(),
256
+ route_prefix: "/static".to_string(),
257
+ index_file: true,
258
+ cache_control: Some("max-age=60".to_string()),
259
+ }],
260
+ ..Default::default()
261
+ };
262
+
263
+ let router = build_router_with_handlers_and_config(Vec::new(), config, Vec::new()).expect("router");
264
+
265
+ let response = router
266
+ .oneshot(
267
+ Request::builder()
268
+ .method("GET")
269
+ .uri("/static/hello.txt")
270
+ .body(Body::empty())
271
+ .expect("request"),
272
+ )
273
+ .await
274
+ .expect("response");
275
+
276
+ assert_eq!(response.status(), StatusCode::OK);
277
+ assert_eq!(
278
+ response
279
+ .headers()
280
+ .get("cache-control")
281
+ .expect("cache-control")
282
+ .to_str()
283
+ .expect("header"),
284
+ "max-age=60"
285
+ );
286
+ }
@@ -0,0 +1,118 @@
1
+ use axum::body::Body;
2
+ use axum::http::{Method as AxumMethod, Request, StatusCode};
3
+ use serde_json::Value;
4
+ use spikard_http::server::build_router_with_handlers_and_config;
5
+ use spikard_http::{Handler, HandlerResult, Method, RequestData, Route, ServerConfig};
6
+ use std::future::Future;
7
+ use std::pin::Pin;
8
+ use std::sync::Arc;
9
+
10
+ struct EchoMethodHandler;
11
+
12
+ impl Handler for EchoMethodHandler {
13
+ fn call(
14
+ &self,
15
+ _request: Request<Body>,
16
+ request_data: RequestData,
17
+ ) -> Pin<Box<dyn Future<Output = HandlerResult> + Send + '_>> {
18
+ Box::pin(async move {
19
+ let body_len = request_data.raw_body.as_ref().map_or(0, bytes::Bytes::len);
20
+ let response_json = serde_json::json!({
21
+ "method": request_data.method,
22
+ "path": request_data.path,
23
+ "path_params": &*request_data.path_params,
24
+ "raw_body_len": body_len,
25
+ });
26
+ Ok(axum::http::Response::builder()
27
+ .status(StatusCode::OK)
28
+ .header("content-type", "application/json")
29
+ .body(Body::from(response_json.to_string()))
30
+ .expect("response builder"))
31
+ })
32
+ }
33
+ }
34
+
35
+ fn route(method: Method, path: &str, expects_json_body: bool) -> Route {
36
+ Route {
37
+ method,
38
+ path: path.to_string(),
39
+ handler_name: "echo_method".to_string(),
40
+ expects_json_body,
41
+ cors: None,
42
+ is_async: true,
43
+ file_params: None,
44
+ request_validator: None,
45
+ response_validator: None,
46
+ parameter_validator: None,
47
+ jsonrpc_method: None,
48
+ #[cfg(feature = "di")]
49
+ handler_dependencies: Vec::new(),
50
+ }
51
+ }
52
+
53
+ async fn assert_method(server: &axum_test::TestServer, method: AxumMethod, path: &str) {
54
+ let response = server.method(method.clone(), path).await;
55
+ assert_eq!(response.status_code(), StatusCode::OK);
56
+ if method == AxumMethod::HEAD {
57
+ return;
58
+ }
59
+ let json: Value = serde_json::from_str(&response.text()).expect("json");
60
+ assert_eq!(json["method"], method.as_str());
61
+ }
62
+
63
+ #[tokio::test]
64
+ async fn router_covers_all_http_methods_with_and_without_path_params() {
65
+ let handler: Arc<dyn Handler> = Arc::new(EchoMethodHandler);
66
+ let route_entries = vec![
67
+ route(Method::Get, "/m", false),
68
+ route(Method::Delete, "/m", false),
69
+ route(Method::Head, "/m", false),
70
+ route(Method::Trace, "/m", false),
71
+ route(Method::Options, "/m", false),
72
+ route(Method::Post, "/m", false),
73
+ route(Method::Put, "/m", false),
74
+ route(Method::Patch, "/m", false),
75
+ route(Method::Get, "/params/{id}", false),
76
+ route(Method::Delete, "/params/{id}", false),
77
+ route(Method::Head, "/params/{id}", false),
78
+ route(Method::Trace, "/params/{id}", false),
79
+ route(Method::Options, "/params/{id}", false),
80
+ route(Method::Post, "/params/{id}", false),
81
+ route(Method::Put, "/params/{id}", false),
82
+ route(Method::Patch, "/params/{id}", false),
83
+ ]
84
+ .into_iter()
85
+ .map(|r| (r, Arc::clone(&handler)))
86
+ .collect();
87
+
88
+ let app_router =
89
+ build_router_with_handlers_and_config(route_entries, ServerConfig::default(), Vec::new()).expect("router");
90
+ let server = axum_test::TestServer::new(app_router).expect("server");
91
+
92
+ assert_method(&server, AxumMethod::GET, "/m").await;
93
+ assert_method(&server, AxumMethod::DELETE, "/m").await;
94
+ assert_method(&server, AxumMethod::HEAD, "/m").await;
95
+ assert_method(&server, AxumMethod::TRACE, "/m").await;
96
+ assert_method(&server, AxumMethod::OPTIONS, "/m").await;
97
+
98
+ let post = server.post("/m").bytes(Vec::from("body").into()).await;
99
+ let post_json: Value = serde_json::from_str(&post.text()).expect("json");
100
+ assert_eq!(post_json["method"], "POST");
101
+ assert_eq!(post_json["raw_body_len"], 4);
102
+
103
+ let put = server.put("/m").bytes(Vec::from("body").into()).await;
104
+ let put_json: Value = serde_json::from_str(&put.text()).expect("json");
105
+ assert_eq!(put_json["method"], "PUT");
106
+ assert_eq!(put_json["raw_body_len"], 4);
107
+
108
+ let patch = server.patch("/m").bytes(Vec::from("body").into()).await;
109
+ let patch_json: Value = serde_json::from_str(&patch.text()).expect("json");
110
+ assert_eq!(patch_json["method"], "PATCH");
111
+ assert_eq!(patch_json["raw_body_len"], 4);
112
+
113
+ assert_method(&server, AxumMethod::GET, "/params/123").await;
114
+ let response = server.method(AxumMethod::DELETE, "/params/123").await;
115
+ assert_eq!(response.status_code(), StatusCode::OK);
116
+ let json: Value = serde_json::from_str(&response.text()).expect("json");
117
+ assert_eq!(json["path_params"]["id"], "123");
118
+ }
@@ -0,0 +1,99 @@
1
+ use axum::body::Body;
2
+ use http_body_util::BodyExt;
3
+ use spikard_http::handler_trait::{Handler, HandlerResult, RequestData};
4
+ use spikard_http::{CompressionConfig, Method, Route, Server, ServerConfig};
5
+ use std::pin::Pin;
6
+ use std::sync::Arc;
7
+ use tower::ServiceExt;
8
+ use uuid::Uuid;
9
+
10
+ struct LargeJsonHandler;
11
+
12
+ impl Handler for LargeJsonHandler {
13
+ fn call(
14
+ &self,
15
+ _request: axum::http::Request<Body>,
16
+ _request_data: RequestData,
17
+ ) -> Pin<Box<dyn std::future::Future<Output = HandlerResult> + Send + '_>> {
18
+ Box::pin(async move {
19
+ let big_value = "x".repeat(2048);
20
+ let body = format!(r#"{{"payload":"{big_value}"}}"#);
21
+ Ok(axum::http::Response::builder()
22
+ .status(200)
23
+ .header("content-type", "application/json")
24
+ .body(Body::from(body))
25
+ .unwrap())
26
+ })
27
+ }
28
+ }
29
+
30
+ fn route(path: &str) -> Route {
31
+ Route {
32
+ path: path.to_string(),
33
+ method: Method::Get,
34
+ handler_name: "large".to_string(),
35
+ expects_json_body: false,
36
+ cors: None,
37
+ is_async: true,
38
+ file_params: None,
39
+ request_validator: None,
40
+ response_validator: None,
41
+ parameter_validator: None,
42
+ jsonrpc_method: None,
43
+ #[cfg(feature = "di")]
44
+ handler_dependencies: vec![],
45
+ }
46
+ }
47
+
48
+ #[tokio::test]
49
+ async fn server_applies_request_id_and_gzip_compression_when_configured() {
50
+ let config = ServerConfig {
51
+ compression: Some(CompressionConfig {
52
+ gzip: true,
53
+ brotli: false,
54
+ min_size: 0,
55
+ quality: 6,
56
+ }),
57
+ enable_request_id: true,
58
+ ..Default::default()
59
+ };
60
+
61
+ let handler: Arc<dyn Handler> = Arc::new(LargeJsonHandler);
62
+ let app = Server::with_handlers(config, vec![(route("/data"), handler)]).unwrap();
63
+
64
+ let response = app
65
+ .oneshot(
66
+ axum::http::Request::builder()
67
+ .method("GET")
68
+ .uri("/data")
69
+ .header("accept-encoding", "gzip")
70
+ .body(Body::empty())
71
+ .unwrap(),
72
+ )
73
+ .await
74
+ .unwrap();
75
+
76
+ let request_id = response
77
+ .headers()
78
+ .get("x-request-id")
79
+ .expect("x-request-id header missing")
80
+ .to_str()
81
+ .unwrap();
82
+ assert!(
83
+ Uuid::parse_str(request_id).is_ok(),
84
+ "x-request-id is not a UUID: {request_id}"
85
+ );
86
+
87
+ assert_eq!(
88
+ response
89
+ .headers()
90
+ .get("content-encoding")
91
+ .expect("content-encoding missing")
92
+ .to_str()
93
+ .unwrap(),
94
+ "gzip"
95
+ );
96
+
97
+ let bytes = response.into_body().collect().await.unwrap().to_bytes();
98
+ assert!(!bytes.is_empty());
99
+ }