feat(body): rename Entity to Payload

Closes #1464
This commit is contained in:
Sean McArthur
2018-04-10 15:55:13 -07:00
parent 313f82d971
commit dfdca25c00
18 changed files with 105 additions and 160 deletions

View File

@@ -113,7 +113,7 @@ macro_rules! test {
let body = res
.into_body()
.into_stream()
.concat2()
.wait()
.expect("body concat wait");
@@ -726,7 +726,7 @@ mod dispatch_impl {
.unwrap();
client.request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
}).and_then(|_| {
Delay::new(Duration::from_secs(1))
.expect("timeout")
@@ -779,7 +779,7 @@ mod dispatch_impl {
.unwrap();
let res = client.request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
let rx = rx1.expect("thread panicked");
res.join(rx).map(|r| r.0).wait().unwrap();
@@ -946,7 +946,7 @@ mod dispatch_impl {
.unwrap();
let res = client.request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
let rx = rx1.expect("thread panicked");
res.join(rx).map(|r| r.0).wait().unwrap();
@@ -994,7 +994,7 @@ mod dispatch_impl {
.unwrap();
let res = client.request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
let rx = rx1.expect("thread panicked");
res.join(rx).map(|r| r.0).wait().unwrap();
@@ -1039,7 +1039,7 @@ mod dispatch_impl {
.unwrap();
let res = client.request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
let rx = rx1.expect("thread panicked");
@@ -1384,7 +1384,7 @@ mod conn {
.unwrap();
let res = client.send_request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
let rx = rx1.expect("thread panicked");
@@ -1430,7 +1430,7 @@ mod conn {
let res = client.send_request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
let rx = rx1.expect("thread panicked");
@@ -1470,7 +1470,7 @@ mod conn {
.unwrap();
let res1 = client.send_request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
// pipelined request will hit NotReady, and thus should return an Error::Cancel
@@ -1543,7 +1543,7 @@ mod conn {
let res = client.send_request(req).and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::SWITCHING_PROTOCOLS);
assert_eq!(res.headers()["Upgrade"], "foobar");
res.into_body().into_stream().concat2()
res.into_body().concat2()
});
let rx = rx1.expect("thread panicked");
@@ -1623,7 +1623,7 @@ mod conn {
let res = client.send_request(req)
.and_then(move |res| {
assert_eq!(res.status(), hyper::StatusCode::OK);
res.into_body().into_stream().concat2()
res.into_body().concat2()
})
.map(|body| {
assert_eq!(body.as_ref(), b"");

View File

@@ -110,7 +110,7 @@ fn get_implicitly_empty() {
fn call(&self, req: Request<Body>) -> Self::Future {
Box::new(req.into_body()
.into_stream()
.concat2()
.map(|buf| {
assert!(buf.is_empty());
@@ -256,7 +256,7 @@ mod response_body_lengths {
fn get_auto_response_with_entity_unknown_length() {
run_test(TestCase {
version: 1,
// no headers means trying to guess from Entity
// no headers means trying to guess from Payload
headers: &[],
body: Bd::Unknown("foo bar baz"),
expects_chunked: true,
@@ -268,7 +268,7 @@ mod response_body_lengths {
fn get_auto_response_with_entity_known_length() {
run_test(TestCase {
version: 1,
// no headers means trying to guess from Entity
// no headers means trying to guess from Payload
headers: &[],
body: Bd::Known("foo bar baz"),
expects_chunked: false,
@@ -281,7 +281,7 @@ mod response_body_lengths {
fn http_10_get_auto_response_with_entity_unknown_length() {
run_test(TestCase {
version: 0,
// no headers means trying to guess from Entity
// no headers means trying to guess from Payload
headers: &[],
body: Bd::Unknown("foo bar baz"),
expects_chunked: false,
@@ -1287,7 +1287,7 @@ impl Service for TestService {
let tx2 = self.tx.clone();
let replies = self.reply.clone();
Box::new(req.into_body().into_stream().for_each(move |chunk| {
Box::new(req.into_body().for_each(move |chunk| {
tx1.lock().unwrap().send(Msg::Chunk(chunk.to_vec())).unwrap();
Ok(())
}).then(move |result| {