pub struct TestApp<'app> { /* private fields */ }Expand description
An in-memory borrowed HTTP adapter over the shared executable operation graph.
Implementations§
Source§impl<'app> TestApp<'app>
impl<'app> TestApp<'app>
pub fn new(app: &'app ExecutableApp) -> Self
pub const fn with_max_body_bytes(self, max_body_bytes: usize) -> Self
Sourcepub const fn with_unverified_security_schemes(self, allow: bool) -> Self
pub const fn with_unverified_security_schemes(self, allow: bool) -> Self
Allows operations that declare a security scheme to run without a
registered verifier. Defaults to false.
Passing true disables the fail-closed guard, so an in-memory test can
exercise a secured operation without registering a verifier.
Sourcepub async fn startup(&self) -> Result<(), DependencyError>
pub async fn startup(&self) -> Result<(), DependencyError>
Runs application startup hooks for an in-memory test lifespan.
§Errors
Returns the first startup failure.
Sourcepub async fn shutdown(&self) -> Result<(), DependencyError>
pub async fn shutdown(&self) -> Result<(), DependencyError>
Runs application shutdown hooks for an in-memory test lifespan.
§Errors
Returns the first cleanup failure after all shutdown hooks have run.
Sourcepub fn with_openapi(self, config: OpenApiConfig) -> Self
pub fn with_openapi(self, config: OpenApiConfig) -> Self
Mounts precompiled OpenAPI JSON and UI assets in the in-memory adapter.
Sourcepub fn with_middleware(self, middleware: impl HttpMiddleware + 'static) -> Self
pub fn with_middleware(self, middleware: impl HttpMiddleware + 'static) -> Self
Registers runtime-neutral HTTP middleware for every request.
Registers shared middleware state for every request.
Sourcepub fn with_scoped_middleware(
self,
scope: MiddlewareScope,
middleware: impl HttpMiddleware + 'static,
) -> Self
pub fn with_scoped_middleware( self, scope: MiddlewareScope, middleware: impl HttpMiddleware + 'static, ) -> Self
Registers runtime-neutral HTTP middleware for one path prefix or operation selection.
Registers shared middleware state for one path prefix or operation selection.
Sourcepub fn with_error_handler(
self,
handler: impl HttpErrorHandler + 'static,
) -> Self
pub fn with_error_handler( self, handler: impl HttpErrorHandler + 'static, ) -> Self
Registers an application-level handler for failure responses.
Registers shared application-level error handler state.