Skip to content

Commit

Permalink
Add Clone impl to PresignedRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoh committed Oct 20, 2023
1 parent 66a3acf commit 5de8b6d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion aws/rust-runtime/aws-inlineable/src/presigning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
use aws_smithy_types::body::SdkBody;
use std::fmt;
use std::time::{Duration, SystemTime};

Expand Down Expand Up @@ -175,10 +176,21 @@ impl PresigningConfigBuilder {
#[non_exhaustive]
pub struct PresignedRequest(HttpRequest);

impl Clone for PresignedRequest {
fn clone(&self) -> Self {
Self(
self.0
.try_clone()
.expect("presigned requests do not have a body"),
)
}
}

impl PresignedRequest {
#[allow(dead_code)]
pub(crate) fn new(inner: HttpRequest) -> Self {
Self(inner)
// throw out the body so we're sure it's cloneable
Self(inner.map(|_body| SdkBody::empty()))
}

/// Returns the HTTP request method.
Expand Down

0 comments on commit 5de8b6d

Please sign in to comment.