default User-Agent and Accept headers

This commit is contained in:
Martin Algesten
2018-12-04 18:05:50 +01:00
parent 9779871f53
commit 5a6ccfdae0

View File

@@ -257,6 +257,12 @@ fn send_prelude(unit: &Unit, method: &str, stream: &mut Stream) -> IoResult<()>
if !has_header(&unit.headers, "host") { if !has_header(&unit.headers, "host") {
write!(prelude, "Host: {}\r\n", unit.url.host().unwrap())?; write!(prelude, "Host: {}\r\n", unit.url.host().unwrap())?;
} }
if !has_header(&unit.headers, "user-agent") {
write!(prelude, "User-Agent: ureq\r\n")?;
}
if !has_header(&unit.headers, "accept") {
write!(prelude, "Accept: */*\r\n")?;
}
// other headers // other headers
for header in &unit.headers { for header in &unit.headers {