Struct webmachine_rust::context::WebmachineResponse
source · pub struct WebmachineResponse {
pub status: u16,
pub headers: BTreeMap<String, Vec<HeaderValue>>,
pub body: Option<Vec<u8>>,
}Expand description
Response that is generated as a result of the webmachine execution
Fields§
§status: u16status code to return
headers: BTreeMap<String, Vec<HeaderValue>>headers to return
body: Option<Vec<u8>>Response Body
Implementations§
source§impl WebmachineResponse
impl WebmachineResponse
sourcepub fn default() -> WebmachineResponse
pub fn default() -> WebmachineResponse
Creates a default response (200 OK)
sourcepub fn has_header(&self, header: &str) -> bool
pub fn has_header(&self, header: &str) -> bool
If the response has the provided header
sourcepub fn add_header(&mut self, header: &str, values: Vec<HeaderValue>)
pub fn add_header(&mut self, header: &str, values: Vec<HeaderValue>)
Adds the header values to the headers
sourcepub fn add_headers(&mut self, headers: HashMap<String, Vec<String>>)
pub fn add_headers(&mut self, headers: HashMap<String, Vec<String>>)
Adds the headers from a HashMap to the headers
sourcepub fn add_cors_headers(&mut self, allowed_methods: &Vec<&str>)
pub fn add_cors_headers(&mut self, allowed_methods: &Vec<&str>)
Adds standard CORS headers to the response
Trait Implementations§
source§impl Clone for WebmachineResponse
impl Clone for WebmachineResponse
source§fn clone(&self) -> WebmachineResponse
fn clone(&self) -> WebmachineResponse
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for WebmachineResponse
impl Debug for WebmachineResponse
source§impl PartialEq<WebmachineResponse> for WebmachineResponse
impl PartialEq<WebmachineResponse> for WebmachineResponse
source§fn eq(&self, other: &WebmachineResponse) -> bool
fn eq(&self, other: &WebmachineResponse) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl StructuralPartialEq for WebmachineResponse
Auto Trait Implementations§
impl RefUnwindSafe for WebmachineResponse
impl Send for WebmachineResponse
impl Sync for WebmachineResponse
impl Unpin for WebmachineResponse
impl UnwindSafe for WebmachineResponse
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