#[non_exhaustive]pub struct DryRun {
pub method: Method,
pub url: String,
pub headers: HeaderMap,
pub body: Value,
}async only.Expand description
A rendered HTTP request that has not been sent.
Contains the exact method, URL, headers, and body the client would
transmit. The Debug impl redacts auth headers; the
raw values are still accessible via Self::headers for callers that
need them.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.method: MethodHTTP method.
url: StringFully-qualified URL the request would be sent to.
headers: HeaderMapAll headers, including x-api-key and anthropic-version.
body: ValueDecoded JSON request body.
Implementations§
Source§impl DryRun
impl DryRun
Sourcepub fn body_pretty(&self) -> String
pub fn body_pretty(&self) -> String
Pretty-printed JSON body. Convenience over serde_json::to_string_pretty.
Sourcepub fn to_curl(&self) -> String
pub fn to_curl(&self) -> String
Render as a curl command. Auth headers (x-api-key,
authorization) are replaced with <REDACTED>. Suitable for sharing
in bug reports.
Sourcepub fn to_curl_with_key(&self, api_key: &str) -> String
pub fn to_curl_with_key(&self, api_key: &str) -> String
Render as a curl command with the given API key inlined for
x-api-key. Use this when you intend to actually run the resulting
command. Anything in authorization is still redacted.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DryRun
impl RefUnwindSafe for DryRun
impl Send for DryRun
impl Sync for DryRun
impl Unpin for DryRun
impl UnsafeUnpin for DryRun
impl UnwindSafe for DryRun
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more