1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-25 17:02:44 +01:00
actix-web/src/client/mod.rs

32 lines
864 B
Rust
Raw Normal View History

2018-02-19 22:18:18 +01:00
//! Http client
2018-01-30 22:04:52 +01:00
mod connector;
2018-01-28 07:03:03 +01:00
mod parser;
mod request;
2018-01-28 07:03:03 +01:00
mod response;
2018-02-19 12:11:11 +01:00
mod pipeline;
mod writer;
2018-01-28 07:03:03 +01:00
2018-02-19 12:11:11 +01:00
pub use self::pipeline::{SendRequest, SendRequestError};
pub use self::request::{ClientRequest, ClientRequestBuilder};
pub use self::response::ClientResponse;
2018-01-30 22:04:52 +01:00
pub use self::connector::{Connect, Connection, ClientConnector, ClientConnectorError};
2018-02-19 12:11:11 +01:00
pub(crate) use self::writer::HttpClientWriter;
pub(crate) use self::parser::{HttpResponseParser, HttpResponseParserError};
use httpcodes;
use httpresponse::HttpResponse;
use error::ResponseError;
/// Convert `SendRequestError` to a `HttpResponse`
impl ResponseError for SendRequestError {
fn error_response(&self) -> HttpResponse {
match *self {
SendRequestError::Connector(_) => httpcodes::HttpBadGateway.into(),
_ => httpcodes::HttpInternalServerError.into(),
}
}
}