From 1bcc70c174053d695e7c55b4954f755b7ba6065b Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 7 Sep 2021 20:36:57 +0900 Subject: [PATCH] [REFACTORING]Use headers utility function for deref() --- plume-common/src/activity_pub/inbox.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/plume-common/src/activity_pub/inbox.rs b/plume-common/src/activity_pub/inbox.rs index 5215c520..5b934136 100644 --- a/plume-common/src/activity_pub/inbox.rs +++ b/plume-common/src/activity_pub/inbox.rs @@ -1,6 +1,7 @@ -use reqwest::header::{HeaderValue, ACCEPT}; use std::fmt::Debug; +use super::request; + /// Represents an ActivityPub inbox. /// /// It routes an incoming Activity through the registered handlers. @@ -311,6 +312,7 @@ pub trait FromId: Sized { id: &str, proxy: Option, ) -> Result, Self::Error)> { + let headers = request::headers(); if let Some(proxy) = proxy { reqwest::ClientBuilder::new().proxy(proxy) } else { @@ -320,16 +322,7 @@ pub trait FromId: Sized { .build() .map_err(|_| (None, InboxError::DerefError.into()))? .get(id) - .header( - ACCEPT, - HeaderValue::from_str( - &super::ap_accept_header() - .into_iter() - .collect::>() - .join(", "), - ) - .map_err(|_| (None, InboxError::DerefError.into()))?, - ) + .headers(headers) .send() .map_err(|_| (None, InboxError::DerefError)) .and_then(|mut r| {