port all optional features to 2018-edition
This commit is contained in:
committed by
Sean McArthur
parent
4773408ae4
commit
3ba4b6eadf
@@ -255,7 +255,7 @@ fn response_timeout() {
|
||||
|
||||
fn gzip_case(response_size: usize, chunk_size: usize) {
|
||||
let content: String = (0..response_size).into_iter().map(|i| format!("test {}", i)).collect();
|
||||
let mut encoder = ::libflate::gzip::Encoder::new(Vec::new()).unwrap();
|
||||
let mut encoder = libflate::gzip::Encoder::new(Vec::new()).unwrap();
|
||||
match encoder.write(content.as_bytes()) {
|
||||
Ok(n) => assert!(n > 0, "Failed to write to encoder."),
|
||||
_ => panic!("Failed to gzip encode string."),
|
||||
@@ -297,7 +297,7 @@ fn gzip_case(response_size: usize, chunk_size: usize) {
|
||||
body.concat2()
|
||||
})
|
||||
.and_then(|buf| {
|
||||
let body = ::std::str::from_utf8(&buf).unwrap();
|
||||
let body = std::str::from_utf8(&buf).unwrap();
|
||||
|
||||
assert_eq!(body, &content);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::io::{Read, Write};
|
||||
fn test_gzip_response() {
|
||||
let content: String = (0..50).into_iter().map(|i| format!("test {}", i)).collect();
|
||||
let chunk_size = content.len() / 3;
|
||||
let mut encoder = ::libflate::gzip::Encoder::new(Vec::new()).unwrap();
|
||||
let mut encoder = libflate::gzip::Encoder::new(Vec::new()).unwrap();
|
||||
match encoder.write(content.as_bytes()) {
|
||||
Ok(n) => assert!(n > 0, "Failed to write to encoder."),
|
||||
_ => panic!("Failed to gzip encode string."),
|
||||
@@ -74,7 +74,7 @@ fn test_gzip_empty_body() {
|
||||
.send()
|
||||
.unwrap();
|
||||
|
||||
let mut body = ::std::string::String::new();
|
||||
let mut body = std::string::String::new();
|
||||
res.read_to_string(&mut body).unwrap();
|
||||
|
||||
assert_eq!(body, "");
|
||||
@@ -104,7 +104,7 @@ fn test_gzip_invalid_body() {
|
||||
// this tests that the request.send() didn't error, but that the error
|
||||
// is in reading the body
|
||||
|
||||
let mut body = ::std::string::String::new();
|
||||
let mut body = std::string::String::new();
|
||||
res.read_to_string(&mut body).unwrap_err();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ fn file() {
|
||||
let form = reqwest::multipart::Form::new()
|
||||
.file("foo", "Cargo.lock").unwrap();
|
||||
|
||||
let fcontents = ::std::fs::read_to_string("Cargo.lock").unwrap();
|
||||
let fcontents = std::fs::read_to_string("Cargo.lock").unwrap();
|
||||
|
||||
let expected_body = format!("\
|
||||
--{0}\r\n\
|
||||
|
||||
@@ -97,9 +97,9 @@ pub fn spawn(txns: Vec<Txn>) -> Server {
|
||||
}
|
||||
}
|
||||
|
||||
match (::std::str::from_utf8(&expected), ::std::str::from_utf8(&buf[..n])) {
|
||||
match (::std::str::from_utf8(&expected), std::str::from_utf8(&buf[..n])) {
|
||||
(Ok(expected), Ok(received)) => {
|
||||
if expected.len() > 300 && ::std::env::var("REQWEST_TEST_BODY_FULL").is_err() {
|
||||
if expected.len() > 300 && std::env::var("REQWEST_TEST_BODY_FULL").is_err() {
|
||||
assert_eq!(
|
||||
expected.len(),
|
||||
received.len(),
|
||||
|
||||
@@ -81,7 +81,7 @@ fn write_timeout_large_body() {
|
||||
read_closes: true
|
||||
};
|
||||
|
||||
let cursor = ::std::io::Cursor::new(body.into_bytes());
|
||||
let cursor = std::io::Cursor::new(body.into_bytes());
|
||||
let url = format!("http://{}/write-timeout", server.addr());
|
||||
let err = client
|
||||
.post(&url)
|
||||
|
||||
Reference in New Issue
Block a user