From f115485dee61f95736e7570ab5c3b2434008e6ed Mon Sep 17 00:00:00 2001 From: Anthony Lukach Date: Thu, 18 Jun 2026 16:39:14 -0700 Subject: [PATCH] chore(core): remove unused HandlerAction::response_headers_mut() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The only callers of `response_headers_mut` were its own three unit tests — no production code path used it. Drop the method, its sole `impl HandlerAction` block, and the tests. Can be re-added as integrator API if a real consumer appears. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/core/src/route_handler.rs | 61 -------------------------------- 1 file changed, 61 deletions(-) diff --git a/crates/core/src/route_handler.rs b/crates/core/src/route_handler.rs index 0a38e6d..4a919b7 100644 --- a/crates/core/src/route_handler.rs +++ b/crates/core/src/route_handler.rs @@ -56,20 +56,6 @@ pub enum HandlerAction { NeedsBody(PendingRequest), } -impl HandlerAction { - /// Returns a mutable reference to the response headers, if available. - /// - /// Returns `Some(&mut HeaderMap)` for `Response` and `Forward` variants, - /// `None` for `NeedsBody` (which has no response yet). - pub fn response_headers_mut(&mut self) -> Option<&mut HeaderMap> { - match self { - HandlerAction::Response(result) => Some(&mut result.headers), - HandlerAction::Forward(fwd) => Some(&mut fwd.headers), - HandlerAction::NeedsBody(_) => None, - } - } -} - /// A presigned URL request for the runtime to execute. pub struct ForwardRequest { /// HTTP method for the backend request. @@ -318,53 +304,6 @@ pub trait RouteHandler: MaybeSend + MaybeSync { mod tests { use super::*; - #[test] - fn test_response_headers_mut_on_response() { - let mut action = HandlerAction::Response(ProxyResult { - status: 200, - headers: HeaderMap::new(), - body: ProxyResponseBody::Empty, - }); - let headers = action.response_headers_mut().unwrap(); - headers.insert("x-custom", "value".parse().unwrap()); - if let HandlerAction::Response(result) = &action { - assert_eq!(result.headers.get("x-custom").unwrap(), "value"); - } - } - - #[test] - fn test_response_headers_mut_on_forward() { - let mut action = HandlerAction::Forward(ForwardRequest { - method: Method::GET, - url: "https://example.com".parse().unwrap(), - headers: HeaderMap::new(), - request_id: String::new(), - }); - assert!(action.response_headers_mut().is_some()); - } - - #[test] - fn test_response_headers_mut_on_needs_body() { - use crate::types::{BucketConfig, S3Operation}; - let mut action = HandlerAction::NeedsBody(PendingRequest { - operation: S3Operation::CreateMultipartUpload { - bucket: "b".into(), - key: "k".into(), - }, - bucket_config: BucketConfig { - name: String::new(), - backend_type: "s3".into(), - backend_prefix: None, - anonymous_access: false, - backend_options: Default::default(), - allowed_roles: Vec::new(), - }, - original_headers: HeaderMap::new(), - request_id: String::new(), - }); - assert!(action.response_headers_mut().is_none()); - } - #[test] fn test_blocks_hop_by_hop_headers() { let mut headers = http::HeaderMap::new();