1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

rename BodyLength to BodySize

This commit is contained in:
Nikolay Kim
2019-03-27 09:24:55 -07:00
parent b6b37d3ea3
commit faa3ea8e5b
18 changed files with 151 additions and 172 deletions

View File

@ -106,9 +106,6 @@ extern crate actix_web_codegen;
#[doc(hidden)]
pub use actix_web_codegen::*;
#[cfg(feature = "client")]
pub use awc as client;
// re-export for convenience
pub use actix_http::Response as HttpResponse;
pub use actix_http::{http, Error, HttpMessage, ResponseError, Result};
@ -145,7 +142,7 @@ pub mod dev {
pub use crate::types::payload::HttpMessageBody;
pub use crate::types::readlines::Readlines;
pub use actix_http::body::{Body, BodyLength, MessageBody, ResponseBody};
pub use actix_http::body::{Body, BodySize, MessageBody, ResponseBody};
pub use actix_http::ResponseBuilder as HttpResponseBuilder;
pub use actix_http::{
Extensions, Head, Payload, PayloadStream, RequestHead, ResponseHead,
@ -371,3 +368,33 @@ pub mod web {
fn_transform(f)
}
}
#[cfg(feature = "client")]
pub mod client {
//! An HTTP Client
//!
//! ```rust
//! # use futures::future::{Future, lazy};
//! use actix_rt::System;
//! use actix_web::client::Client;
//!
//! fn main() {
//! System::new("test").block_on(lazy(|| {
//! let mut client = Client::default();
//!
//! client.get("http://www.rust-lang.org") // <- Create request builder
//! .header("User-Agent", "Actix-web")
//! .send() // <- Send http request
//! .map_err(|_| ())
//! .and_then(|response| { // <- server http response
//! println!("Response: {:?}", response);
//! Ok(())
//! })
//! }));
//! }
//! ```
pub use awc::{
test, Client, ClientBuilder, ClientRequest, ClientResponse, ConnectError,
InvalidUrl, PayloadError, SendRequestError,
};
}

View File

@ -12,7 +12,7 @@ use futures::{Async, Future, Poll};
use regex::Regex;
use time;
use crate::dev::{BodyLength, MessageBody, ResponseBody};
use crate::dev::{BodySize, MessageBody, ResponseBody};
use crate::error::{Error, Result};
use crate::service::{ServiceRequest, ServiceResponse};
use crate::{HttpMessage, HttpResponse};
@ -238,7 +238,7 @@ impl<B> Drop for StreamLog<B> {
}
impl<B: MessageBody> MessageBody for StreamLog<B> {
fn length(&self) -> BodyLength {
fn length(&self) -> BodySize {
self.body.length()
}