pub fn create_temporary_redirect<L: Into<Cow<'static, str>>>(
    state: &State,
    location: L,
) -> Response {
    let mut res = Response::new().with_status(StatusCode::TemporaryRedirect);
    set_redirect_headers(state, &mut res, location);
    res
}
/// Produces a simple empty `Response` with a `Location` header and a 302
/// status.
///
/// # Examples
///
/// ```rust
/// # extern crate gotham;
/// # extern crate hyper;
/// #
/// # use hyper::{Response, StatusCode};
/// # use gotham::state::State;
/// # use gotham::helpers::http::response::create_temporary_redirect;
/// # use gotham::test::TestServer;
/// # use hyper::header::Location;
/// fn handler(state: State) -> (State, Response) {
///     let resp = create_temporary_redirect(&state, "/quick-detour");
///
///     (state, resp)
/// }
/// # fn main() {
/// #     let test_server = TestServer::new(|| Ok(handler)).unwrap();
/// #     let response = test_server
/// #         .client()
/// #         .get("http://example.com/")
/// #         .perform()
/// #         .unwrap();
/// #
/// #     assert_eq!(response.status(), StatusCode::TemporaryRedirect);
/// #     assert_eq!(
/// #         response.headers().get::<Location>(),
/// #         Some(&Location::new("/quick-detour"))
/// #     );
/// # }
/// ```
Produces a simple empty `Response` with a `Location` header and a 302
status.
Produces a simple empty ` Response ` with a ` Location ` header and a 302 status .
pub fn create_temporary_redirect<L: Into<Cow<'static, str>>>(
    state: &State,
    location: L,
) -> Response {
    let mut res = Response::new().with_status(StatusCode::TemporaryRedirect);
    set_redirect_headers(state, &mut res, location);
    res
}
pub fn create_temporary_redirect < L : Into < Cow < ' static , str > > > ( state : & State , location : L , ) -> Response { let mut res = Response :: new ( ) . with_status ( StatusCode :: TemporaryRedirect ) ; set_redirect_headers ( state , & mut res , location ) ; res }
Produces a simple empty `Response` with a `Location` header and a 302
status.
Produces a simple empty ` Response ` with a ` Location ` header and a 302 status .
state
&State
location
L
state
&State
location
L
examples
None
extern crate gotham;
None
extern crate hyper;
None
use hyper::{response, statuscode};
None
use gotham::state::state;
None
use gotham::helpers::http::response::create_temporary_redirect;
None
use gotham::test::testserver;
None
use hyper::header::location;
fn handler(state: State) -> (State, Response) {
let resp = create_temporary_redirect(&state, "/quick-detour").

(state, resp)
}
fn handler ( state : State ) - > ( State Response ) { let resp = create_temporary_redirect ( &state " / quick - detour " ) . ( state resp ) }
fn main() {
None
let test_server = testserver::new(|| ok(handler)).unwrap();
None
let response = test_server
None
.client()
None
.get("http://example.com/")
None
.perform()
None
.unwrap();
None
assert_eq!(response.status(), statuscode::temporaryredirect);
None
assert_eq!(
None
response.headers().get::<location>(),
None
some(&location::new("/quick-detour"))
None
);
None
}
None