mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Adds a test for non-default accept headers
This commit is contained in:
parent
287dc7371f
commit
9b1f2231cb
1 changed files with 17 additions and 0 deletions
|
@ -448,6 +448,23 @@ fn test_load_sets_content_length_to_length_of_request_body() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_load_uses_explicit_accept_from_preserved_headers_in_load_data() {
|
||||||
|
let mut accept_headers = Headers::new();
|
||||||
|
accept_headers.set_raw("Accept".to_owned(), vec![b"text/html".to_vec()]);
|
||||||
|
|
||||||
|
let url = Url::parse("http://mozilla.com").unwrap();
|
||||||
|
let resource_mgr = new_resource_task("Test-agent".to_string(), None);
|
||||||
|
let mut load_data = LoadData::new(url.clone(), None);
|
||||||
|
load_data.data = Some(<[_]>::to_vec("Yay!".as_bytes()));
|
||||||
|
load_data.preserved_headers.set_raw("Accept".to_owned(), vec![b"text/html".to_vec()]);
|
||||||
|
|
||||||
|
let _ = load::<AssertRequestMustHaveHeaders>(load_data, resource_mgr, None, &AssertMustHaveHeadersRequestFactory {
|
||||||
|
expected_headers: accept_headers,
|
||||||
|
body: <[_]>::to_vec("Yay!".as_bytes())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() {
|
fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() {
|
||||||
let mut accept_headers = Headers::new();
|
let mut accept_headers = Headers::new();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue