pub struct HttpResponseBuilder {
pub status: Option<StatusCode>,
pub headers: HashMap<String, String>,
pub body: Option<Vec<u8>>,
}Expand description
Builder pattern to build a HttpResponse
Fields§
§status: Option<StatusCode>§headers: HashMap<String, String>§body: Option<Vec<u8>>Implementations§
Source§impl HttpResponseBuilder
impl HttpResponseBuilder
Sourcepub fn with_status(self, status: StatusCode) -> Self
pub fn with_status(self, status: StatusCode) -> Self
Sets the status code of the response
Sourcepub fn with_header(self, key: &str, value: &str) -> Self
pub fn with_header(self, key: &str, value: &str) -> Self
Adds an header to the response
Sourcepub fn with_content_type(self, content_type: &str) -> Self
pub fn with_content_type(self, content_type: &str) -> Self
Sets the Content-Type header
Trait Implementations§
Source§impl Debug for HttpResponseBuilder
impl Debug for HttpResponseBuilder
Source§impl Default for HttpResponseBuilder
impl Default for HttpResponseBuilder
Source§fn default() -> HttpResponseBuilder
fn default() -> HttpResponseBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HttpResponseBuilder
impl RefUnwindSafe for HttpResponseBuilder
impl Send for HttpResponseBuilder
impl Sync for HttpResponseBuilder
impl Unpin for HttpResponseBuilder
impl UnwindSafe for HttpResponseBuilder
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