aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDongie Agnir <dongie.agnir@gmail.com>2016-03-10 16:10:03 -1000
committerDongie Agnir <dongie.agnir@gmail.com>2016-04-01 16:15:56 -1000
commit0c69442a37ab0f2370cc075fffdd62bce1521826 (patch)
tree6f4f5f4a9b1b8566d8fc8d373f34e4927799b67f
parent7d828a819334f059bda7d14b38694210c7b492e0 (diff)
downloadservo-0c69442a37ab0f2370cc075fffdd62bce1521826.tar.gz
servo-0c69442a37ab0f2370cc075fffdd62bce1521826.zip
Set Content-Type in header
-rw-r--r--components/net_traits/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs
index a741bec034c..f32576fcde5 100644
--- a/components/net_traits/lib.rs
+++ b/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 {