1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

move payload futures from actix-http

This commit is contained in:
Nikolay Kim
2019-03-17 00:48:40 -07:00
parent c80884904c
commit 9012c46fe1
8 changed files with 688 additions and 24 deletions

View File

@@ -393,7 +393,7 @@ mod tests {
#[test]
fn test_json_body() {
let mut req = TestRequest::default().to_request();
let json = block_on(req.json::<MyObject>());
let json = block_on(JsonBody::<_, MyObject>::new(&mut req));
assert!(json_eq(json.err().unwrap(), JsonPayloadError::ContentType));
let mut req = TestRequest::default()
@@ -402,7 +402,7 @@ mod tests {
header::HeaderValue::from_static("application/text"),
)
.to_request();
let json = block_on(req.json::<MyObject>());
let json = block_on(JsonBody::<_, MyObject>::new(&mut req));
assert!(json_eq(json.err().unwrap(), JsonPayloadError::ContentType));
let mut req = TestRequest::default()
@@ -416,7 +416,7 @@ mod tests {
)
.to_request();
let json = block_on(req.json::<MyObject>().limit(100));
let json = block_on(JsonBody::<_, MyObject>::new(&mut req).limit(100));
assert!(json_eq(json.err().unwrap(), JsonPayloadError::Overflow));
let mut req = TestRequest::default()
@@ -431,7 +431,7 @@ mod tests {
.set_payload(Bytes::from_static(b"{\"name\": \"test\"}"))
.to_request();
let json = block_on(req.json::<MyObject>());
let json = block_on(JsonBody::<_, MyObject>::new(&mut req));
assert_eq!(
json.ok().unwrap(),
MyObject {