pub trait ResponseExt {
    fn ok(&self) -> bool;
    fn location(location: &'static str) -> Self;
    fn redirect<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
; fn redirect_with_status<T>(uri: T, status: StatusCode) -> Response<Body>
    where
        T: AsRef<str>
; fn with<T>(t: T, c: &'static str) -> Response<Body>
    where
        T: Into<Body>
, { ... } fn text<T>(t: T) -> Response<Body>
    where
        T: Into<Body>
, { ... } fn html<T>(t: T) -> Response<Body>
    where
        T: Into<Body>
, { ... } fn json<T>(t: T) -> Result<Response<Body>, PayloadError>
    where
        T: Serialize
, { ... } fn stream<S, O, E>(s: S) -> Response<Body>
    where
        S: 'static + Stream<Item = Result<O, E>> + Send,
        O: 'static + Into<Bytes>,
        E: 'static + Error + Send + Sync
, { ... } fn see_other<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
, { ... } fn temporary<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
, { ... } fn permanent<T>(url: T) -> Response<Body>
    where
        T: AsRef<str>
, { ... } }

Required Methods

The response was successful (status in the range 200-299) or not.

The response redirects to the specified URL.

The response redirects to the specified URL and the status code.

Provided Methods

Response body with Content-Type

Response TEXT

Response HTML

Available on crate feature json only.

Response JSON

Response Stream

Implementations on Foreign Types

Implementors