pub struct HttpResponse {
pub status: StatusCode,
pub headers: HashMap<String, String>,
pub body: Option<Vec<u8>>,
}Expand description
Represents an HTTP Response send to a client
Fields§
§status: StatusCodeHTTP status code
headers: HashMap<String, String>HTTP headers
body: Option<Vec<u8>>Body
Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn builder() -> HttpResponseBuilder
pub fn builder() -> HttpResponseBuilder
Create a new builder to construct a HttpResponse
Sourcepub fn ok(content_type: &str) -> HttpResponseBuilder
pub fn ok(content_type: &str) -> HttpResponseBuilder
Create a preconfigured builder for 200 OK response
Sourcepub fn not_found() -> HttpResponseBuilder
pub fn not_found() -> HttpResponseBuilder
Create a preconfigured builder for 404 Not Found response
Sourcepub fn method_not_allowed() -> HttpResponseBuilder
pub fn method_not_allowed() -> HttpResponseBuilder
Create a preconfigured builder for 405 Method Not Allowed response
Sourcepub fn internal_server_error() -> HttpResponseBuilder
pub fn internal_server_error() -> HttpResponseBuilder
Create a preconfigured builder for 500 Internal Server Error
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnwindSafe for HttpResponse
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