use crate::FEDERATION_CONTENT_TYPE;
use axum::response::IntoResponse;
use http::header;
use serde::Serialize;
#[derive(Debug, Clone, Copy, Default)]
pub struct FederationJson<Json: Serialize>(pub Json);
impl<Json: Serialize> IntoResponse for FederationJson<Json> {
fn into_response(self) -> axum::response::Response {
let mut response = axum::response::Json(self.0).into_response();
response.headers_mut().insert(
header::CONTENT_TYPE,
FEDERATION_CONTENT_TYPE
.parse()
.expect("Parsing 'application/activity+json' should never fail"),
);
response
}
}