From 236767f49888b1f891fc54324e9b7ee3390c2e16 Mon Sep 17 00:00:00 2001 From: Bat Date: Sat, 23 Jun 2018 12:23:37 +0100 Subject: [PATCH] Send the 'Content-Type: application/activity+json' header for ActivityPub request Should fix #76 --- src/activity_pub/request.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/activity_pub/request.rs b/src/activity_pub/request.rs index e0e25171..401bb000 100644 --- a/src/activity_pub/request.rs +++ b/src/activity_pub/request.rs @@ -1,7 +1,13 @@ use base64; use openssl::hash::{Hasher, MessageDigest}; -use reqwest::header::{Date, Headers, UserAgent}; -use std::time::SystemTime; +use reqwest::{ + mime::Mime, + header::{ContentType, Date, Headers, UserAgent} +}; +use std::{ + str::FromStr, + time::SystemTime +}; use activity_pub::sign::Signer; @@ -19,6 +25,7 @@ pub fn headers() -> Headers { let mut headers = Headers::new(); headers.set(UserAgent::new(USER_AGENT)); headers.set(Date(SystemTime::now().into())); + headers.set(ContentType(Mime::from_str("application/activity+json").unwrap())); headers }