Struct thruster::builtins::basic_hyper_context::BasicHyperContext [−][src]
pub struct BasicHyperContext { pub body: String, pub query_params: HashMap<String, String>, pub request: Request<Body>, pub status: u16, pub headers: HashMap<String, String>, }
Fields
body: String
query_params: HashMap<String, String>
request: Request<Body>
status: u16
headers: HashMap<String, String>
Methods
impl BasicHyperContext
[src]
impl BasicHyperContext
pub fn new() -> BasicHyperContext
[src]
pub fn new() -> BasicHyperContext
pub fn param(&mut self, key: &str) -> Option<&String>
[src]
pub fn param(&mut self, key: &str) -> Option<&String>
Get a a parameter
pub fn set(&mut self, key: &str, value: &str)
[src]
pub fn set(&mut self, key: &str, value: &str)
Set a header on the response
pub fn remove(&mut self, key: &str)
[src]
pub fn remove(&mut self, key: &str)
Remove a header on the response
pub fn status(&mut self, code: u16)
[src]
pub fn status(&mut self, code: u16)
Set the response status code
pub fn content_type(&mut self, c_type: &str)
[src]
pub fn content_type(&mut self, c_type: &str)
Set the response Content-Type
. A shortcode for
ⓘThis example is not tested
ctx.set("Content-Type", "some-val");
pub fn redirect(&mut self, destination: &str)
[src]
pub fn redirect(&mut self, destination: &str)
Set up a redirect, will default to 302, but can be changed after the fact.
ⓘThis example is not tested
ctx.set("Location", "/some-path"); ctx.status(302);
Sets a cookie on the response
Trait Implementations
impl Context for BasicHyperContext
[src]
impl Context for BasicHyperContext
type Response = Response<Body>
fn get_response(self) -> Self::Response
[src]
fn get_response(self) -> Self::Response
fn set_body(&mut self, body: String)
[src]
fn set_body(&mut self, body: String)
impl HasQueryParams for BasicHyperContext
[src]
impl HasQueryParams for BasicHyperContext
Auto Trait Implementations
impl Send for BasicHyperContext
impl Send for BasicHyperContext
impl !Sync for BasicHyperContext
impl !Sync for BasicHyperContext