pub struct Response {
pub status: u16,
pub headers: HashMap<String, String>,
pub body: Vec<u8>,
}Expand description
Represents an HTTP response to be sent by the harness
Fields§
§status: u16§headers: HashMap<String, String>§body: Vec<u8>Implementations§
Source§impl Response
impl Response
pub fn new(status: u16) -> Self
pub fn ok() -> Self
pub fn created() -> Self
pub fn not_found() -> Self
pub fn internal_error() -> Self
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_body(self, body: impl Into<Vec<u8>>) -> Self
pub fn with_json<T: Serialize>(self, value: &T) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
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