[][src]Struct webmachine_rust::context::WebmachineResponse

pub struct WebmachineResponse {
    pub status: u16,
    pub headers: BTreeMap<String, Vec<HeaderValue>>,
    pub body: Option<Vec<u8>>,
}

Response that is generated as a result of the webmachine execution

Fields

status: u16

status code to return

headers: BTreeMap<String, Vec<HeaderValue>>

headers to return

body: Option<Vec<u8>>

Response Body

Implementations

impl WebmachineResponse[src]

pub fn default() -> WebmachineResponse[src]

Creates a default response (200 OK)

pub fn has_header(&self, header: &str) -> bool[src]

If the response has the provided header

pub fn add_header(&mut self, header: &str, values: Vec<HeaderValue>)[src]

Adds the header values to the headers

pub fn add_headers(&mut self, headers: HashMap<String, Vec<String>>)[src]

Adds the headers from a HashMap to the headers

pub fn add_cors_headers(&mut self, allowed_methods: &Vec<&str>)[src]

Adds standard CORS headers to the response

pub fn cors_headers(allowed_methods: &Vec<&str>) -> HashMap<String, Vec<String>>[src]

Returns a HashMap of standard CORS headers

pub fn has_body(&self) -> bool[src]

If the response has a body

Trait Implementations

impl Clone for WebmachineResponse[src]

impl Debug for WebmachineResponse[src]

impl PartialEq<WebmachineResponse> for WebmachineResponse[src]

impl StructuralPartialEq for WebmachineResponse[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.