Skip to content

Commit fd33844

Browse files
committed
Address PR #594 review feedback
- Fix PassThrough doc comment operation order (set_body before finalize) - Update function doc to describe actual PassThrough flow (set_body + send_to_client, not io::copy) - Remove dead _enters_early_return variable, replace with comment
1 parent ef576a1 commit fd33844

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

crates/trusted-server-adapter-fastly/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,7 @@ async fn route_request(
238238
// Response already sent via stream_to_client()
239239
return None;
240240
}
241-
Ok(PublisherResponse::PassThrough {
242-
mut response,
243-
body,
244-
}) => {
241+
Ok(PublisherResponse::PassThrough { mut response, body }) => {
245242
// Binary pass-through: reattach body and send via send_to_client().
246243
// This preserves Content-Length and avoids chunked encoding overhead.
247244
// Fastly streams the body from its internal buffer — no WASM

crates/trusted-server-core/src/publisher.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ pub enum PublisherResponse {
275275
params: OwnedProcessResponseParams,
276276
},
277277
/// Non-processable 2xx response (images, fonts, video). The caller must:
278-
/// 1. Call `finalize_response()` on the response
279-
/// 2. Reattach the body via `response.set_body(body)`
278+
/// 1. Reattach the body via `response.set_body(body)`
279+
/// 2. Call `finalize_response()` on the response
280280
/// 3. Call `response.send_to_client()`
281281
///
282282
/// `Content-Length` is preserved — the body is unmodified. Using
@@ -819,10 +819,9 @@ mod tests {
819819
// pass-through doesn't process, so the host is irrelevant.
820820
let should_process = false;
821821
let is_success = true;
822-
let request_host_empty = true;
823-
// In production: enters the `!should_process || request_host.is_empty()` block,
824-
// then the PassThrough guard checks `is_success && !should_process` — host irrelevant.
825-
let _enters_early_return = !should_process || request_host_empty;
822+
// In production, empty host enters the early-return block via
823+
// `!should_process || request_host.is_empty()`. The PassThrough guard
824+
// checks `is_success && !should_process` — host is irrelevant.
826825
let should_pass_through = is_success && !should_process;
827826
assert!(
828827
should_pass_through,

0 commit comments

Comments
 (0)