Struct stream_httparse::Response [−][src]
pub struct Response<'a> { /* fields omitted */ }Expand description
Represents a single HTTP-Request
Implementations
impl<'a> Response<'a>[src]
impl<'a> Response<'a>[src]pub fn new(
protocol: &'a str,
status_code: StatusCode,
headers: Headers<'a>,
body: Vec<u8>
) -> Self[src]
pub fn new(
protocol: &'a str,
status_code: StatusCode,
headers: Headers<'a>,
body: Vec<u8>
) -> Self[src]Creates a new Response with the given Data as its inital State
pub fn serialize(&self) -> (Vec<u8>, &[u8])[src]
pub fn serialize(&self) -> (Vec<u8>, &[u8])[src]Serialzes the Response and returns the Data as a tuple of form (HTTP-Head, HTTP-Body)
pub fn status_code(&self) -> &StatusCode[src]
pub fn status_code(&self) -> &StatusCode[src]Returns the StatusCode of the Response
pub fn add_header<'b, K, V>(&mut self, key: K, value: V) where
'b: 'a,
K: Into<HeaderKey<'a>>,
V: Into<HeaderValue<'a>>, [src]
pub fn add_header<'b, K, V>(&mut self, key: K, value: V) where
'b: 'a,
K: Into<HeaderKey<'a>>,
V: Into<HeaderValue<'a>>, [src]Adds the Key-Value Pair as a new Header to the Response or replaces the old Value of the Header if it already existed on the Response
pub fn set_body(&mut self, n_body: Vec<u8>)[src]
pub fn set_body(&mut self, n_body: Vec<u8>)[src]Replaces the old Body of the Response with the new given Body and updates the Content-Length Header as well with the new Length
pub fn is_chunked(&self) -> bool[src]
pub fn is_chunked(&self) -> bool[src]Checks if the Response is send using
Transfer-Encoding: Chunked