-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(webserver): move answer routes to webserver (#2704)
* refactor(webserver): move answer routes to webserver * fix
- Loading branch information
Showing
16 changed files
with
114 additions
and
91 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use axum::http::HeaderName; | ||
use axum_extra::headers::Header; | ||
|
||
use crate::constants::USER_HEADER_FIELD_NAME; | ||
|
||
#[derive(Debug)] | ||
pub struct MaybeUser(pub Option<String>); | ||
|
||
pub static USER_HEADER: HeaderName = HeaderName::from_static(USER_HEADER_FIELD_NAME); | ||
|
||
impl Header for MaybeUser { | ||
fn name() -> &'static axum::http::HeaderName { | ||
&USER_HEADER | ||
} | ||
|
||
fn decode<'i, I>(values: &mut I) -> Result<Self, axum_extra::headers::Error> | ||
where | ||
Self: Sized, | ||
I: Iterator<Item = &'i axum::http::HeaderValue>, | ||
{ | ||
let Some(value) = values.next() else { | ||
return Ok(MaybeUser(None)); | ||
}; | ||
let str = value.to_str().expect("User email is always a valid string"); | ||
Ok(MaybeUser(Some(str.to_string()))) | ||
} | ||
|
||
fn encode<E: Extend<axum::http::HeaderValue>>(&self, _values: &mut E) { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
pub mod answer; | ||
pub mod code; | ||
pub mod completion; | ||
pub mod doc; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.