Auto merge of #17521 - KiChjang:update-fetch, r=jdm

Update fetch methods

Includes updates to main fetch, scheme fetch, HTTP fetch, HTTP-redirect fetch, HTTP-network fetch, HTTP-network-or-cache fetch and CORS preflight fetch.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17521)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-18 18:39:02 -05:00 committed by GitHub
commit 9f64630eaa
9 changed files with 259 additions and 261 deletions

View file

@ -208,7 +208,7 @@ fn test_cors_preflight_fetch() {
let handler = move |request: HyperRequest, mut response: HyperResponse| {
if request.method == Method::Options && state.clone().fetch_add(1, Ordering::SeqCst) == 0 {
assert!(request.headers.has::<AccessControlRequestMethod>());
assert!(request.headers.has::<AccessControlRequestHeaders>());
assert!(!request.headers.has::<AccessControlRequestHeaders>());
assert!(!request.headers.get::<HyperReferer>().unwrap().contains("a.html"));
response.headers_mut().set(AccessControlAllowOrigin::Any);
response.headers_mut().set(AccessControlAllowCredentials);
@ -247,7 +247,7 @@ fn test_cors_preflight_cache_fetch() {
let handler = move |request: HyperRequest, mut response: HyperResponse| {
if request.method == Method::Options && state.clone().fetch_add(1, Ordering::SeqCst) == 0 {
assert!(request.headers.has::<AccessControlRequestMethod>());
assert!(request.headers.has::<AccessControlRequestHeaders>());
assert!(!request.headers.has::<AccessControlRequestHeaders>());
response.headers_mut().set(AccessControlAllowOrigin::Any);
response.headers_mut().set(AccessControlAllowCredentials);
response.headers_mut().set(AccessControlAllowMethods(vec![Method::Get]));
@ -297,7 +297,7 @@ fn test_cors_preflight_fetch_network_error() {
let handler = move |request: HyperRequest, mut response: HyperResponse| {
if request.method == Method::Options && state.clone().fetch_add(1, Ordering::SeqCst) == 0 {
assert!(request.headers.has::<AccessControlRequestMethod>());
assert!(request.headers.has::<AccessControlRequestHeaders>());
assert!(!request.headers.has::<AccessControlRequestHeaders>());
response.headers_mut().set(AccessControlAllowOrigin::Any);
response.headers_mut().set(AccessControlAllowCredentials);
response.headers_mut().set(AccessControlAllowMethods(vec![Method::Get]));

View file

@ -1,11 +1,5 @@
[cors-preflight.any.html]
type: testharness
[CORS [DELETE\], server allows]
expected: FAIL
[CORS [PUT\], server allows]
expected: FAIL
[CORS [PATCH\], server allows]
expected: FAIL
@ -27,18 +21,8 @@
[CORS [PUT\] [several headers\], server allows]
expected: FAIL
[CORS [PUT\] [only safe headers\], server allows]
expected: FAIL
[cors-preflight.any.worker.html]
type: testharness
[CORS [DELETE\], server allows]
expected: FAIL
[CORS [PUT\], server allows]
expected: FAIL
[CORS [PATCH\], server allows]
expected: FAIL
@ -59,7 +43,3 @@
[CORS [PUT\] [several headers\], server allows]
expected: FAIL
[CORS [PUT\] [only safe headers\], server allows]
expected: FAIL