Fix a couple client headers

This commit is contained in:
asonix 2020-04-21 14:18:18 -05:00
parent 0ffcb74de6
commit 84a396fc1e

View file

@ -13,17 +13,15 @@ pub struct Requests {
key_id: String, key_id: String,
private_key: RSAPrivateKey, private_key: RSAPrivateKey,
config: Config, config: Config,
user_agent: String,
} }
impl Requests { impl Requests {
pub fn new(key_id: String, private_key: RSAPrivateKey, user_agent: String) -> Self { pub fn new(key_id: String, private_key: RSAPrivateKey, user_agent: String) -> Self {
Requests { Requests {
client: Client::default(), client: Client::build().header("User-Agent", user_agent).finish(),
key_id, key_id,
private_key, private_key,
config: Config::default().dont_use_created_field(), config: Config::default().dont_use_created_field(),
user_agent,
} }
} }
@ -37,7 +35,6 @@ impl Requests {
.client .client
.get(url) .get(url)
.header("Accept", "application/activity+json") .header("Accept", "application/activity+json")
.header("User-Agent", self.user_agent.as_str())
.signature( .signature(
self.config.clone(), self.config.clone(),
self.key_id.clone(), self.key_id.clone(),
@ -76,8 +73,7 @@ impl Requests {
let mut res = self let mut res = self
.client .client
.get(url) .get(url)
.header("Accept", "application/activity+json") .header("Accept", "*/*")
.header("User-Agent", self.user_agent.as_str())
.signature( .signature(
self.config.clone(), self.config.clone(),
self.key_id.clone(), self.key_id.clone(),
@ -136,7 +132,6 @@ impl Requests {
.post(inbox.as_str()) .post(inbox.as_str())
.header("Accept", "application/activity+json") .header("Accept", "application/activity+json")
.header("Content-Type", "application/activity+json") .header("Content-Type", "application/activity+json")
.header("User-Agent", self.user_agent.as_str())
.signature_with_digest( .signature_with_digest(
self.config.clone(), self.config.clone(),
self.key_id.clone(), self.key_id.clone(),