Skip to content

Commit 62758de

Browse files
Surface S3 origin errors before image optimization
1 parent e76a38e commit 62758de

2 files changed

Lines changed: 344 additions & 26 deletions

File tree

crates/trusted-server-core/src/platform/test_support.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ pub(crate) struct StubHttpClient {
217217
// Headers captured per send call, stored as (name, value) string pairs.
218218
request_headers: Mutex<Vec<Vec<(String, String)>>>,
219219
image_optimizer_options: Mutex<Vec<Option<PlatformImageOptimizerOptions>>>,
220+
request_methods: Mutex<Vec<String>>,
220221
request_uris: Mutex<Vec<String>>,
221222
}
222223

@@ -233,6 +234,7 @@ impl StubHttpClient {
233234
responses: Mutex::new(VecDeque::new()),
234235
request_headers: Mutex::new(Vec::new()),
235236
image_optimizer_options: Mutex::new(Vec::new()),
237+
request_methods: Mutex::new(Vec::new()),
236238
request_uris: Mutex::new(Vec::new()),
237239
}
238240
}
@@ -286,6 +288,14 @@ impl StubHttpClient {
286288
.clone()
287289
}
288290

291+
/// Return request methods captured per `send` call, in order.
292+
pub fn recorded_request_methods(&self) -> Vec<String> {
293+
self.request_methods
294+
.lock()
295+
.expect("should lock request methods")
296+
.clone()
297+
}
298+
289299
/// Return request URIs captured per `send` call, in order.
290300
pub fn recorded_request_uris(&self) -> Vec<String> {
291301
self.request_uris
@@ -311,6 +321,10 @@ impl PlatformHttpClient for StubHttpClient {
311321
.lock()
312322
.expect("should lock image optimizer options")
313323
.push(request.image_optimizer.clone());
324+
self.request_methods
325+
.lock()
326+
.expect("should lock request methods")
327+
.push(request.request.method().to_string());
314328
self.request_uris
315329
.lock()
316330
.expect("should lock request URIs")

0 commit comments

Comments
 (0)