Trait oxide_auth::code_grant::frontend::WebResponse
[−]
[src]
pub trait WebResponse where
Self: Sized, { type Error: From<OAuthError>; fn redirect(url: Url) -> Result<Self, Self::Error>; fn text(text: &str) -> Result<Self, Self::Error>; fn json(data: &str) -> Result<Self, Self::Error>; fn as_client_error(self) -> Result<Self, Self::Error>; fn as_unauthorized(self) -> Result<Self, Self::Error>; fn with_authorization(self, kind: &str) -> Result<Self, Self::Error>; fn redirect_error(target: ErrorUrl) -> Result<Self, Self::Error> { ... } }
Response representation into which the Request is transformed by the code_grant types.
Associated Types
type Error: From<OAuthError>
The error generated when trying to construct an unhandled or invalid response.
Required Methods
fn redirect(url: Url) -> Result<Self, Self::Error>
A response which will redirect the user-agent to which the response is issued.
fn text(text: &str) -> Result<Self, Self::Error>
A pure text response with no special media type set.
fn json(data: &str) -> Result<Self, Self::Error>
Json repsonse data, with media type `aplication/json.
fn as_client_error(self) -> Result<Self, Self::Error>
Set the response status to 400
Set the response status to 401
Add an Authorization header
Provided Methods
fn redirect_error(target: ErrorUrl) -> Result<Self, Self::Error>
Construct a redirect for the error. Here the response may choose to augment the error with additional information (such as help websites, description strings), hence the default implementation which does not do any of that.