Fix ws tests.
This commit is contained in:
parent
5f5476ceb8
commit
dd21e61371
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::io::{Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::str::{self, Lines};
|
use std::str::{self, Lines};
|
||||||
use std::net::{TcpStream, SocketAddr};
|
use std::net::{TcpStream, SocketAddr};
|
||||||
|
|
||||||
@ -87,6 +87,7 @@ pub fn request(address: &SocketAddr, request: &str) -> Response {
|
|||||||
loop {
|
loop {
|
||||||
let mut chunk = [0; 32 *1024];
|
let mut chunk = [0; 32 *1024];
|
||||||
match req.read(&mut chunk) {
|
match req.read(&mut chunk) {
|
||||||
|
Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => break,
|
||||||
Err(err) => panic!("Unable to read response: {:?}", err),
|
Err(err) => panic!("Unable to read response: {:?}", err),
|
||||||
Ok(0) => break,
|
Ok(0) => break,
|
||||||
Ok(read) => response.extend_from_slice(&chunk[..read]),
|
Ok(read) => response.extend_from_slice(&chunk[..read]),
|
||||||
|
Loading…
Reference in New Issue
Block a user