diff --git a/aws/rust-runtime/aws-inlineable/src/aws_chunked.rs b/aws/rust-runtime/aws-inlineable/src/aws_chunked.rs index bb647f248f4..9b1542b1ac1 100644 --- a/aws/rust-runtime/aws-inlineable/src/aws_chunked.rs +++ b/aws/rust-runtime/aws-inlineable/src/aws_chunked.rs @@ -184,6 +184,7 @@ mod tests { file.as_file_mut().write_all(line.as_bytes()).unwrap(); } + let stream_length = file.as_file().metadata().unwrap().len(); let request = HttpRequest::new( ByteStream::read_from() .path(&file) @@ -200,7 +201,7 @@ mod tests { let interceptor = AwsChunkedContentEncodingInterceptor; let mut cfg = ConfigBag::base(); cfg.interceptor_state() - .store_put(AwsChunkedBodyOptions::default()); + .store_put(AwsChunkedBodyOptions::default().with_stream_length(stream_length)); let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap(); let mut ctx = InterceptorContext::new(Input::doesnt_matter()); ctx.enter_serialization_phase(); @@ -220,7 +221,12 @@ mod tests { body_data.extend_from_slice(&data.unwrap()) } let body_str = std::str::from_utf8(&body_data).unwrap(); - assert!(body_str.ends_with("0\r\n\r\n")); + + let expected = "This is a large file created for testing purposes 9999\r\n0\r\n\r\n"; + assert!( + body_str.ends_with(expected), + "expected '{body_str}' to end with '{expected}'" + ); } #[tokio::test]