mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Removes HttpRequest, adds HttpResponse wrapper
The HttpRequest trait doesn't make sense, on further reflection. Rather, just modify the method signature on the requester. The hyper request was only being used to mutate it's headers anyway. servo/servo#6727
This commit is contained in:
parent
7633cd54c2
commit
81fe5938bf
2 changed files with 91 additions and 85 deletions
|
@ -2,7 +2,7 @@
|
|||
* 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 net::http_loader::{load, LoadError, HttpRequester, HttpRequest};
|
||||
use net::http_loader::{load, LoadError, HttpRequester, HttpResponse};
|
||||
use url::Url;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use ipc_channel::ipc;
|
||||
|
@ -10,15 +10,12 @@ use net_traits::LoadData;
|
|||
use net::hsts::HSTSList;
|
||||
use hyper::client::Response;
|
||||
use hyper::method::Method;
|
||||
use hyper::header::Headers;
|
||||
|
||||
struct MockHttpRequester;
|
||||
|
||||
impl HttpRequester for MockHttpRequester {
|
||||
fn build(&self, url: Url, _: Method) -> Result<Box<HttpRequest>, LoadError> {
|
||||
Err(LoadError::Connection(url.clone(), "shouldn't connect".to_string()))
|
||||
}
|
||||
|
||||
fn send(&self, _: Box<HttpRequest>) -> Result<Response, LoadError> {
|
||||
fn send(&self, _: &Url, _: &Method, _: &Headers, _: &Option<Vec<u8>>) -> Result<Box<HttpResponse>, LoadError> {
|
||||
Err(LoadError::Connection(Url::parse("http://example.com").unwrap(), "shouldn't connect".to_string()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue