Skip to content
Permalink
Browse files

Set Content-Type in header

  • Loading branch information...
dagnir committed Mar 11, 2016
1 parent 7d828a8 commit 0c69442a37ab0f2370cc075fffdd62bce1521826
Showing with 9 additions and 0 deletions.
  1. +9 −0 components/net_traits/lib.rs
@@ -336,9 +336,18 @@ impl Metadata {

/// Extract the parts of a Mime that we care about.
pub fn set_content_type(&mut self, content_type: Option<&Mime>) {
match self.headers {
None => self.headers = Some(Headers::new()),
Some(_) => (),
}

match content_type {
None => (),
Some(mime) => {
if let Some(headers) = self.headers.as_mut() {
headers.set(ContentType(mime.clone()));
}

self.content_type = Some(ContentType(mime.clone()));
let &Mime(_, _, ref parameters) = mime;
for &(ref k, ref v) in parameters {

0 comments on commit 0c69442

Please sign in to comment.
You can’t perform that action at this time.