diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 7ef663d5255..6cd19bef12c 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use fetch::cors_cache::{BasicCORSCache, CORSCache, CacheRequestDetails}; -use fetch::response::ResponseMethods; use http_loader::{NetworkHttpRequestFactory, WrappedHttpResponse}; use http_loader::{create_http_connector, obtain_response, read_block, ReadResult}; use hyper::client::response::Response as HyperResponse; diff --git a/components/net/fetch/response.rs b/components/net/fetch/response.rs deleted file mode 100644 index 150e149ec26..00000000000 --- a/components/net/fetch/response.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use hyper::header::Headers; -use hyper::status::StatusCode; -use net_traits::response::{CacheState, HttpsState, Response, ResponseBody, ResponseType}; -use std::ascii::AsciiExt; -use std::cell::{Cell, RefCell}; -use std::rc::Rc; -use std::sync::mpsc::Receiver; -use std::sync::{Arc, Mutex}; -use url::Url; - -pub trait ResponseMethods { - fn new() -> Response; -} - -impl ResponseMethods for Response { - fn new() -> Response { - Response { - response_type: ResponseType::Default, - termination_reason: None, - url: None, - url_list: RefCell::new(Vec::new()), - status: Some(StatusCode::Ok), - headers: Headers::new(), - body: Arc::new(Mutex::new(ResponseBody::Empty)), - cache_state: CacheState::None, - https_state: HttpsState::None, - internal_response: None, - return_internal: Cell::new(true) - } - } -} - diff --git a/components/net/lib.rs b/components/net/lib.rs index fa354bfc439..6ef801ca7b7 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -49,5 +49,4 @@ pub mod fetch { #![allow(dead_code, unused)] // XXXManishearth this is only temporary until the Fetch mod starts being used pub mod cors_cache; pub mod methods; - pub mod response; } diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs index f86e4614793..b8167f41d6c 100644 --- a/components/net_traits/response.rs +++ b/components/net_traits/response.rs @@ -93,6 +93,22 @@ pub struct Response { } impl Response { + pub fn new() -> Response { + Response { + response_type: ResponseType::Default, + termination_reason: None, + url: None, + url_list: RefCell::new(Vec::new()), + status: Some(StatusCode::Ok), + headers: Headers::new(), + body: Arc::new(Mutex::new(ResponseBody::Empty)), + cache_state: CacheState::None, + https_state: HttpsState::None, + internal_response: None, + return_internal: Cell::new(true) + } + } + pub fn network_error() -> Response { Response { response_type: ResponseType::Error, diff --git a/tests/unit/net/fetch.rs b/tests/unit/net/fetch.rs index e881d8b24a7..208c8c22c9a 100644 --- a/tests/unit/net/fetch.rs +++ b/tests/unit/net/fetch.rs @@ -11,7 +11,6 @@ use hyper::server::{Request as HyperRequest, Response as HyperResponse}; use hyper::status::StatusCode; use hyper::uri::RequestUri; use net::fetch::methods::{fetch, fetch_async}; -use net::fetch::response::ResponseMethods; use net_traits::request::{Origin, RedirectMode, Referer, Request, RequestMode}; use net_traits::response::{CacheState, Response, ResponseBody, ResponseType}; use net_traits::{AsyncFetchListener};