Skip to content

Commit

Permalink
refactor(client): set Host header first
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Nov 28, 2016
1 parent 7cab063 commit 4bc4f1f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,15 @@ impl<'a> RequestBuilder<'a> {
message.set_proxied(true);
}

let mut headers = match headers {
Some(ref headers) => headers.clone(),
None => Headers::new(),
};
headers.set(Host {
let mut h = Headers::new();
h.set(Host {
hostname: host.to_owned(),
port: Some(port),
});
if let Some(ref headers) = headers {
h.extend(headers.iter());
}
let headers = h;
Request::with_headers_and_message(method.clone(), url.clone(), headers, message)
};

Expand Down

0 comments on commit 4bc4f1f

Please sign in to comment.