mirror of
https://github.com/fafhrd91/actix-web
synced 2024-12-18 01:43:58 +01:00
update tests
This commit is contained in:
parent
86405cfe7a
commit
1f9467e880
@ -50,7 +50,7 @@ fn test_start() {
|
|||||||
|
|
||||||
let mut connector = test::run_on(|| {
|
let mut connector = test::run_on(|| {
|
||||||
Ok::<_, ()>(
|
Ok::<_, ()>(
|
||||||
client::Connector::default()
|
client::Connector::new()
|
||||||
.timeout(Duration::from_millis(100))
|
.timeout(Duration::from_millis(100))
|
||||||
.service(),
|
.service(),
|
||||||
)
|
)
|
||||||
|
@ -69,7 +69,7 @@ fn test_body_gzip() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -100,7 +100,7 @@ fn test_body_gzip_large() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -134,7 +134,7 @@ fn test_body_gzip_large_random() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -167,7 +167,7 @@ fn test_body_chunked_implicit() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
|
|
||||||
// decode
|
// decode
|
||||||
let mut e = GzDecoder::new(&bytes[..]);
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
@ -195,7 +195,7 @@ fn test_body_br_streaming() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
|
|
||||||
// decode br
|
// decode br
|
||||||
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
||||||
@ -222,7 +222,7 @@ fn test_head_binary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
assert!(bytes.is_empty());
|
assert!(bytes.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ fn test_no_chunking() {
|
|||||||
assert!(!response.headers().contains_key(TRANSFER_ENCODING));
|
assert!(!response.headers().contains_key(TRANSFER_ENCODING));
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ fn test_body_deflate() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
|
|
||||||
// decode deflate
|
// decode deflate
|
||||||
let mut e = ZlibDecoder::new(Vec::new());
|
let mut e = ZlibDecoder::new(Vec::new());
|
||||||
@ -294,7 +294,7 @@ fn test_body_brotli() {
|
|||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// read response
|
// read response
|
||||||
let bytes = srv.execute(response.body()).unwrap();
|
let bytes = srv.block_on(response.body()).unwrap();
|
||||||
|
|
||||||
// decode brotli
|
// decode brotli
|
||||||
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
|
||||||
@ -327,11 +327,11 @@ fn test_body_brotli() {
|
|||||||
// .header(http::header::CONTENT_ENCODING, "gzip")
|
// .header(http::header::CONTENT_ENCODING, "gzip")
|
||||||
// .body(enc.clone())
|
// .body(enc.clone())
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
// let response = srv.block_on(request.send()).unwrap();
|
||||||
// assert!(response.status().is_success());
|
// assert!(response.status().is_success());
|
||||||
|
|
||||||
// // read response
|
// // read response
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
// let bytes = srv.block_on(response.body()).unwrap();
|
||||||
// assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
// assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -360,11 +360,11 @@ fn test_body_brotli() {
|
|||||||
// .header(http::header::CONTENT_ENCODING, "gzip")
|
// .header(http::header::CONTENT_ENCODING, "gzip")
|
||||||
// .body(enc.clone())
|
// .body(enc.clone())
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
// let response = srv.block_on(request.send()).unwrap();
|
||||||
// assert!(response.status().is_success());
|
// assert!(response.status().is_success());
|
||||||
|
|
||||||
// // read response
|
// // read response
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
// let bytes = srv.block_on(response.body()).unwrap();
|
||||||
// assert_eq!(bytes, Bytes::from(data));
|
// assert_eq!(bytes, Bytes::from(data));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -397,11 +397,11 @@ fn test_body_brotli() {
|
|||||||
// .header(http::header::CONTENT_ENCODING, "gzip")
|
// .header(http::header::CONTENT_ENCODING, "gzip")
|
||||||
// .body(enc.clone())
|
// .body(enc.clone())
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
// let response = srv.block_on(request.send()).unwrap();
|
||||||
// assert!(response.status().is_success());
|
// assert!(response.status().is_success());
|
||||||
|
|
||||||
// // read response
|
// // read response
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
// let bytes = srv.block_on(response.body()).unwrap();
|
||||||
// assert_eq!(bytes.len(), data.len());
|
// assert_eq!(bytes.len(), data.len());
|
||||||
// assert_eq!(bytes, Bytes::from(data));
|
// assert_eq!(bytes, Bytes::from(data));
|
||||||
// }
|
// }
|
||||||
@ -430,11 +430,11 @@ fn test_body_brotli() {
|
|||||||
// .header(http::header::CONTENT_ENCODING, "deflate")
|
// .header(http::header::CONTENT_ENCODING, "deflate")
|
||||||
// .body(enc)
|
// .body(enc)
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
// let response = srv.block_on(request.send()).unwrap();
|
||||||
// assert!(response.status().is_success());
|
// assert!(response.status().is_success());
|
||||||
|
|
||||||
// // read response
|
// // read response
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
// let bytes = srv.block_on(response.body()).unwrap();
|
||||||
// assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
// assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -463,11 +463,11 @@ fn test_body_brotli() {
|
|||||||
// .header(http::header::CONTENT_ENCODING, "deflate")
|
// .header(http::header::CONTENT_ENCODING, "deflate")
|
||||||
// .body(enc)
|
// .body(enc)
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
// let response = srv.block_on(request.send()).unwrap();
|
||||||
// assert!(response.status().is_success());
|
// assert!(response.status().is_success());
|
||||||
|
|
||||||
// // read response
|
// // read response
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
// let bytes = srv.block_on(response.body()).unwrap();
|
||||||
// assert_eq!(bytes, Bytes::from(data));
|
// assert_eq!(bytes, Bytes::from(data));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ fn test_body_brotli() {
|
|||||||
// .header(http::header::CONTENT_ENCODING, "deflate")
|
// .header(http::header::CONTENT_ENCODING, "deflate")
|
||||||
// .body(enc)
|
// .body(enc)
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
// let response = srv.block_on(request.send()).unwrap();
|
||||||
// assert!(response.status().is_success());
|
// assert!(response.status().is_success());
|
||||||
|
|
||||||
// // read response
|
// // read response
|
||||||
|
Loading…
Reference in New Issue
Block a user