sfr_server/response/
oauth.rs1use crate::response::{CT_TEXT_HTML, CT_TEXT_PLAIN};
4use axum::body::Body;
5use axum::http::Response;
6use axum::response::IntoResponse;
7
8#[derive(Debug)]
10pub enum OauthRedirectResponse {
11 Text(String),
13
14 Html(String),
16}
17
18impl OauthRedirectResponse {
19 pub fn text(inner: String) -> Self {
21 Self::Text(inner)
22 }
23
24 pub fn html(inner: String) -> Self {
26 Self::Html(inner)
27 }
28}
29
30impl IntoResponse for OauthRedirectResponse {
31 fn into_response(self) -> Response<Body> {
32 match self {
33 Self::Text(inner) => ([CT_TEXT_PLAIN], inner).into_response(),
34
35 Self::Html(inner) => ([CT_TEXT_HTML], inner).into_response(),
36 }
37 }
38}