pub struct WebhookResource {
pub url: String,
pub port: u16,
/* private fields */
}Expand description
Webhook server resource for capturing HTTP requests
Fields§
§url: StringThe base URL of the webhook server (e.g., “http://127.0.0.1:8080”)
port: u16The port the server is listening on
Implementations§
Source§impl WebhookResource
impl WebhookResource
Sourcepub async fn new_with_response_plan(
response_plan: Vec<StatusCode>,
) -> Result<Self>
pub async fn new_with_response_plan( response_plan: Vec<StatusCode>, ) -> Result<Self>
Start a new webhook server with a scripted sequence of response statuses.
Sourcepub fn webhook_url(&self) -> String
pub fn webhook_url(&self) -> String
Get the URL for the webhook endpoint
Sourcepub fn request_count(&self) -> usize
pub fn request_count(&self) -> usize
Get the number of requests received
Sourcepub fn get_requests(&self) -> Vec<CapturedRequest>
pub fn get_requests(&self) -> Vec<CapturedRequest>
Get all captured requests
Sourcepub fn get_request_bodies_as_string(&self) -> Vec<String>
pub fn get_request_bodies_as_string(&self) -> Vec<String>
Get all captured request bodies as strings (for JSON verification)
Sourcepub fn get_request_bodies_as_json(&self) -> Vec<Value>
pub fn get_request_bodies_as_json(&self) -> Vec<Value>
Parse all captured request bodies as JSON
Sourcepub async fn wait_for_requests(&self, count: usize, timeout: Duration) -> bool
pub async fn wait_for_requests(&self, count: usize, timeout: Duration) -> bool
Wait for at least N requests with a timeout
Auto Trait Implementations§
impl !RefUnwindSafe for WebhookResource
impl !UnwindSafe for WebhookResource
impl Freeze for WebhookResource
impl Send for WebhookResource
impl Sync for WebhookResource
impl Unpin for WebhookResource
impl UnsafeUnpin for WebhookResource
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.