Add optional accept header
This commit is contained in:
parent
b9dc926978
commit
da90b45b67
@ -97,11 +97,16 @@ fn redirect<T: Service>(
|
|||||||
cache.clear();
|
cache.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Box::new(
|
let req = client
|
||||||
client
|
|
||||||
.get(&T::api_url(&data))
|
.get(&T::api_url(&data))
|
||||||
.header(header::USER_AGENT, statics::USER_AGENT.as_str())
|
.header(header::USER_AGENT, statics::USER_AGENT.as_str());
|
||||||
.send()
|
let req = if let Some(accept) = T::api_accept() {
|
||||||
|
req.header(header::ACCEPT, accept)
|
||||||
|
} else {
|
||||||
|
req
|
||||||
|
};
|
||||||
|
Box::new(
|
||||||
|
req.send()
|
||||||
.from_err()
|
.from_err()
|
||||||
.and_then(move |response| T::request_head(response, data, client, Arc::clone(&cache))),
|
.and_then(move |response| T::request_head(response, data, client, Arc::clone(&cache))),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user