pub struct TestRequest {
pub method: String,
pub path: String,
pub headers: Vec<(String, String)>,
pub body: Option<Bytes>,
pub remote_addr: Option<SocketAddr>,
pub timeout: Option<Duration>,
}Expand description
One test request: what TestClient::send
dispatches.
Fields§
§method: StringThe method, any case.
path: StringThe path, with any query string.
headers: Vec<(String, String)>Header lines in order; a name may repeat.
body: Option<Bytes>The body, when there is one.
remote_addr: Option<SocketAddr>The peer the server sees; 127.0.0.1:0 when unset.
timeout: Option<Duration>Bounds the whole exchange from the client side.
Implementations§
Source§impl TestRequest
impl TestRequest
Sourcepub fn from_lua(method: &str, path: &str, opts: Option<&Table>) -> Result<Self>
pub fn from_lua(method: &str, path: &str, opts: Option<&Table>) -> Result<Self>
Reads a request from method, path and the options table:
headers, query, cookies, auth, one of body/json/form/
multipart, remote_addr, timeout. Unknown keys are ignored;
wrong types raise.
§Errors
Two body options, a malformed option, or a value that does not encode.
Trait Implementations§
Source§impl Clone for TestRequest
impl Clone for TestRequest
Source§impl Debug for TestRequest
impl Debug for TestRequest
Auto Trait Implementations§
impl !Freeze for TestRequest
impl RefUnwindSafe for TestRequest
impl Send for TestRequest
impl Sync for TestRequest
impl Unpin for TestRequest
impl UnsafeUnpin for TestRequest
impl UnwindSafe for TestRequest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more