mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-25 00:12:59 +01:00
32 lines
864 B
Rust
32 lines
864 B
Rust
//! Http client
|
|
mod connector;
|
|
mod parser;
|
|
mod request;
|
|
mod response;
|
|
mod pipeline;
|
|
mod writer;
|
|
|
|
pub use self::pipeline::{SendRequest, SendRequestError};
|
|
pub use self::request::{ClientRequest, ClientRequestBuilder};
|
|
pub use self::response::ClientResponse;
|
|
pub use self::connector::{Connect, Connection, ClientConnector, ClientConnectorError};
|
|
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(),
|
|
}
|
|
}
|
|
}
|