Struct thruster::builtins::basic_context::BasicContext [−][src]
pub struct BasicContext { pub body: String, pub params: HashMap<String, String>, pub query_params: HashMap<String, String>, pub request: Request, pub status: u32, pub headers: HashMap<String, String>, }
Fields
body: String
params: HashMap<String, String>
query_params: HashMap<String, String>
request: Request
status: u32
headers: HashMap<String, String>
Methods
impl BasicContext
[src]
impl BasicContext
pub fn new() -> BasicContext
[src]
pub fn new() -> BasicContext
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: u32)
[src]
pub fn status(&mut self, code: u32)
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 BasicContext
[src]
impl Context for BasicContext
type Response = Response
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 BasicContext
[src]
impl HasQueryParams for BasicContext
Auto Trait Implementations
impl Send for BasicContext
impl Send for BasicContext
impl Sync for BasicContext
impl Sync for BasicContext