Struct arc_reactor::prelude::Response[][src]

pub struct Response { /* fields omitted */ }

Methods

impl Response
[src]

Get the HTTP version of this response.

Get the headers from the response.

Get a mutable reference to the headers.

Get the status from the server.

Set the StatusCode for this response.

Example

This example is not tested
pub fn get_profile(req: Request, res: Response) {
    // performed task on request

    // return an 401 response
    res.set_status(401);
}

Set the status and move the Response.

Useful for the "builder-style" pattern.

Set a text/plain response.

set a text/plain response moves the response

useful for builder-style

get a reference to a type previously set on the response

Set a type on the response.

Removes the type previously set on the response.

Respond with a file. this method will set the appropriate Content-type and Content-Length headers unfortunately, this doesn't support byte ranges, yet. The file is streamed asynchronously from the filesystem to the client with the Content-Encoding: chunked.

Set the body and move the Response.

Useful for the "builder-style" pattern.

Read the body.

Take the Body of this response.

Set a HTTP redirect on the response header

Set the status code 401 on the response

Set the status code 400 on the response

Set the status code 403 on the response

Set the status code 405 on the response

Set the status code 406 on the response

Set the status code 408 on the response

Set the status code 500 on the response

Set the status code 502 on the response

Set the status code 503 on the response

Trait Implementations

impl<T: Serialize> From<(u16, T)> for Response
[src]

Performs the conversion.

impl From<Response> for Response<Body>
[src]

Performs the conversion.

impl From<JsonError> for Response
[src]

Performs the conversion.

impl From<QueryParseError> for Response
[src]

Performs the conversion.

impl<T> MiddleWare<Response> for T where
    T: Fn(Response) -> MiddleWareFuture<Response> + Send + Sync + Clone + 'static, 
[src]

impl MiddleWare<Response> for Vec<Box<MiddleWare<Response>>>
[src]

This enables a vector of MiddleWare<Request> to behave like a single MiddleWare<Request> returning Err(Response) in any of the MiddleWare<Request> will cause the rest of the middlewares to be skipped. Note that there's a conveinient macro mw that allows you not write boxes everywhere.

impl MiddleWare<Response> for Box<MiddleWare<Response>>
[src]

impl Debug for Response
[src]

Formats the value using the given formatter. Read more

impl Default for Response
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for Response

impl !Sync for Response