Add optional accept header

This commit is contained in:
Valentin Brandl 2019-08-09 22:38:46 +02:00
parent b9dc926978
commit da90b45b67
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -97,11 +97,16 @@ fn redirect<T: Service>(
cache.clear();
}
}
let req = client
.get(&T::api_url(&data))
.header(header::USER_AGENT, statics::USER_AGENT.as_str());
let req = if let Some(accept) = T::api_accept() {
req.header(header::ACCEPT, accept)
} else {
req
};
Box::new(
client
.get(&T::api_url(&data))
.header(header::USER_AGENT, statics::USER_AGENT.as_str())
.send()
req.send()
.from_err()
.and_then(move |response| T::request_head(response, data, client, Arc::clone(&cache))),
)