pub struct TestResponse { /* private fields */ }Expand description
The response returned by the in-process pipeline, with inspection helpers.
Returned by TestRequest::send. Inspect it with status,
header, text, and
body_bytes.
The body is fully collected (streamed bodies are drained), so the accessors are synchronous.
Implementations§
Source§impl TestResponse
impl TestResponse
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
The response status code.
Sourcepub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
The full response header map, for headers that may appear more than
once — Set-Cookie above all, which must never be folded into one
comma-separated value.
Sourcepub fn header(&self, name: &str) -> Option<&str>
pub fn header(&self, name: &str) -> Option<&str>
The value of response header name as a string, or None if absent or
not valid UTF-8. Matching is case-insensitive.
Sourcepub fn body_bytes(&self) -> &Bytes
pub fn body_bytes(&self) -> &Bytes
The raw response body bytes.
Auto Trait Implementations§
impl !Freeze for TestResponse
impl RefUnwindSafe for TestResponse
impl Send for TestResponse
impl Sync for TestResponse
impl Unpin for TestResponse
impl UnsafeUnpin for TestResponse
impl UnwindSafe for TestResponse
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