Fixes tidy overlong lines

This commit is contained in:
Sam Gibson 2015-08-15 22:04:14 +10:00
parent ea2d7f4dd5
commit 15d82091c5
2 changed files with 28 additions and 13 deletions

View file

@ -22,7 +22,8 @@ use hyper::client::Request;
use hyper::header::StrictTransportSecurity;
use hyper::header::{AcceptEncoding, Accept, ContentLength, ContentType, Host, Location, qitem, Quality, QualityItem};
use hyper::client::{Request, Response};
use hyper::header::{AcceptEncoding, Accept, ContentLength, ContentType, Host, Location, qitem, StrictTransportSecurity};
use hyper::header::{AcceptEncoding, Accept, ContentLength, ContentType, Host};
use hyper::header::{Location, qitem, StrictTransportSecurity};
use hyper::header::{Quality, QualityItem, Headers, ContentEncoding, Encoding};
use hyper::Error as HttpError;
use hyper::method::Method;
@ -199,7 +200,10 @@ impl HttpRequestFactory for NetworkHttpRequestFactory {
return Err(
LoadError::Ssl(
url.clone(),
format!("ssl error {:?}: {:?} {:?}", io_error.kind(), io_error.description(), io_error.cause())
format!("ssl error {:?}: {:?} {:?}",
io_error.kind(),
io_error.description(),
io_error.cause())
)
)
},
@ -468,7 +472,10 @@ pub fn load<A>(mut load_data: LoadData,
match load_data.cors {
Some(ref c) => {
if c.preflight {
return Err(LoadError::Cors(url, "Preflight fetch inconsistent with main fetch".to_string()));
return Err(
LoadError::Cors(
url,
"Preflight fetch inconsistent with main fetch".to_string()));
} else {
// XXXManishearth There are some CORS-related steps here,
// but they don't seem necessary until credentials are implemented

View file

@ -284,10 +284,12 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re
let mut cookie = Headers::new();
cookie.set_raw("Cookie".to_owned(), vec![<[_]>::to_vec("mozillaIs=theBest".as_bytes())]);
let _ = load::<AssertMustHaveHeadersRequest>(load_data.clone(), resource_mgr, None, &AssertMustHaveHeadersRequestFactory {
expected_headers: cookie,
body: <[_]>::to_vec(&*load_data.data.unwrap())
});
let _ = load::<AssertMustHaveHeadersRequest>(
load_data.clone(), resource_mgr, None,
&AssertMustHaveHeadersRequestFactory {
expected_headers: cookie,
body: <[_]>::to_vec(&*load_data.data.unwrap())
});
}
#[test]
@ -300,18 +302,24 @@ fn test_load_sets_content_length_to_length_of_request_body() {
load_data.data = Some(<[_]>::to_vec(content.as_bytes()));
let mut content_len_headers= Headers::new();
content_len_headers.set_raw("Content-Length".to_owned(), vec![<[_]>::to_vec(&*format!("{}", content.len()).as_bytes())]);
content_len_headers.set_raw(
"Content-Length".to_owned(), vec![<[_]>::to_vec(&*format!("{}", content.len()).as_bytes())]
);
let _ = load::<AssertMustHaveHeadersRequest>(load_data.clone(), resource_mgr, None, &AssertMustHaveHeadersRequestFactory {
expected_headers: content_len_headers,
body: <[_]>::to_vec(&*load_data.data.unwrap())
});
let _ = load::<AssertMustHaveHeadersRequest>(
load_data.clone(), resource_mgr, None,
&AssertMustHaveHeadersRequestFactory {
expected_headers: content_len_headers,
body: <[_]>::to_vec(&*load_data.data.unwrap())
});
}
#[test]
fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() {
let mut accept_headers = Headers::new();
accept_headers.set_raw("Accept".to_owned(), vec![b"text/html, application/xhtml+xml, application/xml; q=0.9, */*; q=0.8".to_vec()]);
accept_headers.set_raw(
"Accept".to_owned(), vec![b"text/html, application/xhtml+xml, application/xml; q=0.9, */*; q=0.8".to_vec()]
);
let url = Url::parse("http://mozilla.com").unwrap();
let resource_mgr = new_resource_task(None, None);