From 3749a6c9613eeb460a60b4d45bc446ae56696bb6 Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Fri, 18 Jun 2021 08:24:55 -0700 Subject: [PATCH] Fix response tracing for streaming response bodies (#514) * Fix response tracing for streaming response bodies * Log everything except for the streaming body for streaming responses --- rust-runtime/smithy-http/src/middleware.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-runtime/smithy-http/src/middleware.rs b/rust-runtime/smithy-http/src/middleware.rs index 26f024654..11d0a84ef 100644 --- a/rust-runtime/smithy-http/src/middleware.rs +++ b/rust-runtime/smithy-http/src/middleware.rs @@ -77,11 +77,10 @@ where O: ParseHttpResponse>, { if let Some(parsed_response) = handler.parse_unloaded(&mut response) { + trace!(response = ?response); return sdk_result(parsed_response, response); } - trace!(response = ?response); - let (parts, body) = response.into_parts(); let body = match read_body(body).await { Ok(body) => body, @@ -94,6 +93,7 @@ where }; let response = Response::from_parts(parts, Bytes::from(body)); + trace!(response = ?response); let parsed = handler.parse_loaded(&response); sdk_result(parsed, response.map(SdkBody::from)) } -- GitLab