pub struct APIClientBuilder { /* private fields */ }Expand description
Builder for creating APIClient with custom configuration
§Example
use reinhardt_testkit::client::{APIClientBuilder, HttpVersion};
use std::time::Duration;
let client = APIClientBuilder::new()
.base_url("http://localhost:8080")
.timeout(Duration::from_secs(30))
.http_version(HttpVersion::Http2PriorKnowledge)
.cookie_store(true)
.build();Implementations§
Source§impl APIClientBuilder
impl APIClientBuilder
Sourcepub fn http_version(self, version: HttpVersion) -> Self
pub fn http_version(self, version: HttpVersion) -> Self
Set the HTTP version
Sourcepub fn http1_only(self) -> Self
pub fn http1_only(self) -> Self
Use HTTP/1.1 only (convenience method)
Sourcepub fn http2_prior_knowledge(self) -> Self
pub fn http2_prior_knowledge(self) -> Self
Use HTTP/2 with prior knowledge (convenience method)
Enable or disable automatic cookie storage
Sourcepub fn handler(self, handler: impl HttpHandler + 'static) -> Self
pub fn handler(self, handler: impl HttpHandler + 'static) -> Self
Set a reinhardt Handler for in-process request dispatching.
When set, requests bypass the network and are handled directly by the given Handler, running the full middleware stack in-process.
The calling test must run inside a tokio runtime (e.g., #[tokio::test]).
Sourcepub fn di_context(self, ctx: Arc<InjectionContext>) -> Self
pub fn di_context(self, ctx: Arc<InjectionContext>) -> Self
Set a DI context for in-process handler requests.
The context is injected into every reinhardt Request before
dispatching to the Handler.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for APIClientBuilder
impl !RefUnwindSafe for APIClientBuilder
impl Send for APIClientBuilder
impl Sync for APIClientBuilder
impl Unpin for APIClientBuilder
impl UnsafeUnpin for APIClientBuilder
impl !UnwindSafe for APIClientBuilder
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().