diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/net/fetch/request.rs | 27 | ||||
-rw-r--r-- | src/components/net/fetch/response.rs | 10 |
2 files changed, 19 insertions, 18 deletions
diff --git a/src/components/net/fetch/request.rs b/src/components/net/fetch/request.rs index 069c30541ea..2de606a1a31 100644 --- a/src/components/net/fetch/request.rs +++ b/src/components/net/fetch/request.rs @@ -32,25 +32,24 @@ pub enum Referer { /// A [request mode](http://fetch.spec.whatwg.org/#concept-request-mode) pub enum RequestMode { - SameOrigin, // same-origin - NoCORS, // No CORS - CORSMode, // CORS - ForcedPreflightMode // CORS-with-forced-preflight + SameOrigin, + NoCORS, + CORSMode, + ForcedPreflightMode } /// Request [credentials mode](http://fetch.spec.whatwg.org/#concept-request-credentials-mode) pub enum CredentialsMode { - Omit, // omit - CredentialsSameOrigin, // same-origin - Include // include + Omit, + CredentialsSameOrigin, + Include } - -// [Response tainting](http://fetch.spec.whatwg.org/#concept-request-response-tainting) +/// [Response tainting](http://fetch.spec.whatwg.org/#concept-request-response-tainting) pub enum ResponseTainting { - Basic, // basic - CORSTainting, // CORS - Opaque // Opaque + Basic, + CORSTainting, + Opaque } /// A [Request](http://fetch.spec.whatwg.org/#requests) as defined by the Fetch spec @@ -104,6 +103,6 @@ impl Request { manual_redirect: false, redirect_count: 0, response_tainting: Basic - } + } } -}
\ No newline at end of file +} diff --git a/src/components/net/fetch/response.rs b/src/components/net/fetch/response.rs index 57a44c468f6..ee98f388f7b 100644 --- a/src/components/net/fetch/response.rs +++ b/src/components/net/fetch/response.rs @@ -10,7 +10,7 @@ use http::headers::response::HeaderCollection; use std::ascii::OwnedStrAsciiExt; // [Response type](http://fetch.spec.whatwg.org/#concept-response-type) -#[deriving(Clone)] +#[deriving(Clone, PartialEq)] pub enum ResponseType { Basic, CORS, @@ -37,7 +37,7 @@ pub struct Response { pub headers: HeaderCollection, pub body: Option<Vec<u8>>, /// [Internal response](http://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response is a filtered response - pub internal_response: Option<Box<Response>>, + pub internal_response: Option<Box<Response>>, } impl Response { @@ -60,9 +60,11 @@ impl Response { } } - /// Convert to a filtered response, of type `filter_type` + /// Convert to a filtered response, of type `filter_type`. /// Do not use with type Error or Default pub fn to_filtered(self, filter_type: ResponseType) -> Response { + assert!(filter_type != Error); + assert!(filter_type != Default); if self.is_network_error() { return self; } @@ -103,4 +105,4 @@ impl Response { } response } -}
\ No newline at end of file +} |