mirror of
https://github.com/LemmyNet/activitypub-federation-rust
synced 2025-01-10 18:58:42 +00:00
9332c81458
* feat: add actix feature flag * (WIP)feat: add axum feature * WIP: axum veridy digest + example Note: this does not compile yet * WIP * chore: clippy lints * Use actix rt for axum example * ci: run example in CI for both actix and axum * feat: add json wrapper type for axum * docs: update readme with actix and axum feature flags * fix: fix ci * chore: more clippy lints * refactor: update according to PR comment and factorize 'verify_digest'
24 lines
552 B
Rust
24 lines
552 B
Rust
/// Necessary because of this issue: https://github.com/actix/actix-web/issues/1711
|
|
#[derive(Debug)]
|
|
pub struct Error(anyhow::Error);
|
|
|
|
impl<T> From<T> for Error
|
|
where
|
|
T: Into<anyhow::Error>,
|
|
{
|
|
fn from(t: T) -> Self {
|
|
Error(t.into())
|
|
}
|
|
}
|
|
|
|
mod axum {
|
|
use super::Error;
|
|
use axum::response::{IntoResponse, Response};
|
|
use http::StatusCode;
|
|
|
|
impl IntoResponse for Error {
|
|
fn into_response(self) -> Response {
|
|
(StatusCode::INTERNAL_SERVER_ERROR, format!("{}", self.0)).into_response()
|
|
}
|
|
}
|
|
}
|