Consistently use content-type sniffing with all protocols.

This commit is contained in:
Eli Friedman 2015-10-15 17:16:47 -07:00
parent 53d8f04ac4
commit aef06f2f20
5 changed files with 44 additions and 38 deletions

View file

@ -17,11 +17,14 @@ fn assert_parse(url: &'static str,
charset: Option<String>,
data: Option<Vec<u8>>) {
use net::data_loader::load;
use net::mime_classifier::MIMEClassifier;
use std::sync::Arc;
use std::sync::mpsc::channel;
use url::Url;
let (start_chan, start_port) = ipc::channel().unwrap();
load(LoadData::new(Url::parse(url).unwrap(), None), Channel(start_chan));
let classifier = Arc::new(MIMEClassifier::new());
load(LoadData::new(Url::parse(url).unwrap(), None), Channel(start_chan), classifier);
let response = start_port.recv().unwrap();
assert_eq!(&response.metadata.content_type, &content_type);