Struct axum_test::TestServerConfigBuilder
source · pub struct TestServerConfigBuilder { /* private fields */ }
Expand description
This is for easing the building of TestServerConfig
.
For full documentation see there.
use ::axum_test::TestServerConfig;
let config = TestServerConfig::builder()
.save_cookies()
.default_content_type(&"application/json")
.build();
These can be passed to TestServer::new_with_config
:
use ::axum::Router;
use ::axum_test::TestServer;
use ::axum_test::TestServerConfig;
let my_app = Router::new();
let config = TestServerConfig::builder()
.save_cookies()
.default_content_type(&"application/json")
.build();
// Build the Test Server
let server = TestServer::new_with_config(my_app, config)?;
Implementations§
source§impl TestServerConfigBuilder
impl TestServerConfigBuilder
pub fn http_transport(self) -> Self
pub fn http_transport_with_ip_port( self, ip: Option<IpAddr>, port: Option<u16>, ) -> Self
pub fn mock_transport(self) -> Self
pub fn transport(self, transport: Transport) -> Self
pub fn default_content_type(self, content_type: &str) -> Self
pub fn default_scheme(self, scheme: &str) -> Self
pub fn expect_success_by_default(self) -> Self
pub fn restrict_requests_with_http_schema(self) -> Self
pub fn build(self) -> TestServerConfig
Trait Implementations§
source§impl Clone for TestServerConfigBuilder
impl Clone for TestServerConfigBuilder
source§fn clone(&self) -> TestServerConfigBuilder
fn clone(&self) -> TestServerConfigBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TestServerConfigBuilder
impl Debug for TestServerConfigBuilder
Auto Trait Implementations§
impl Freeze for TestServerConfigBuilder
impl RefUnwindSafe for TestServerConfigBuilder
impl Send for TestServerConfigBuilder
impl Sync for TestServerConfigBuilder
impl Unpin for TestServerConfigBuilder
impl UnwindSafe for TestServerConfigBuilder
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