From 6df4b703184a92adc89d6eb809326dfa13d67180 Mon Sep 17 00:00:00 2001 From: Bat Date: Thu, 21 Jun 2018 17:30:07 +0100 Subject: [PATCH] Set @context for ActivityStream responder --- src/activity_pub/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/activity_pub/mod.rs b/src/activity_pub/mod.rs index 44e564fa..eff1e421 100644 --- a/src/activity_pub/mod.rs +++ b/src/activity_pub/mod.rs @@ -69,7 +69,9 @@ impl ActivityStream { impl<'r, O: Object> Responder<'r> for ActivityStream { fn respond_to(self, request: &Request) -> Result, Status> { - serde_json::to_string(&self.0).respond_to(request).map(|r| Response::build_from(r) + let mut json = serde_json::to_value(&self.0).map_err(|e| Status::InternalServerError)?; + json["@context"] = context(); + serde_json::to_string(&json).respond_to(request).map(|r| Response::build_from(r) .raw_header("Content-Type", "application/activity+json") .finalize()) }