pub struct HttpResult {
pub success: bool,
pub status: Option<u16>,
pub body: Option<Value>,
pub error: Option<String>,
pub interrupted: bool,
pub retryable: bool,
pub request_id: Option<String>,
pub retry_after: Option<String>,
pub retry_after_ms: Option<String>,
}Expand description
Result of an HTTP request attempt.
Fields§
§success: boolWhether the request completed successfully.
status: Option<u16>HTTP status code, if a response was received.
body: Option<Value>Response body, if available.
error: Option<String>Error message, if the request failed.
interrupted: boolWhether the request was interrupted by the user.
retryable: boolWhether the failure is transient and worth retrying.
request_id: Option<String>Unique request identifier for end-to-end tracing.
Propagated via the X-Request-ID header.
retry_after: Option<String>Value of the Retry-After response header, if present.
Used to honor server-requested retry delays on 429/503 responses.
retry_after_ms: Option<String>Value of the retry-after-ms response header, if present.
More precise than Retry-After (milliseconds instead of seconds).
Implementations§
Source§impl HttpResult
impl HttpResult
Sourcepub fn interrupted() -> Self
pub fn interrupted() -> Self
Create an interrupted result.
Sourcepub fn retryable_status(
status: u16,
body: Option<Value>,
retry_after: Option<String>,
) -> Self
pub fn retryable_status( status: u16, body: Option<Value>, retry_after: Option<String>, ) -> Self
Create a result from an HTTP response with a retryable status.
Sourcepub fn with_request_id(self, request_id: impl Into<String>) -> Self
pub fn with_request_id(self, request_id: impl Into<String>) -> Self
Attach a request ID to this result for tracing.