From 3f95cce9e8d6bcc763023dfe17b32720dee782a0 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 19 Feb 2018 20:03:57 -0800 Subject: [PATCH] allow to pass different binary data --- src/test.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test.rs b/src/test.rs index 4581e9ed..2fbb7c8f 100644 --- a/src/test.rs +++ b/src/test.rs @@ -7,7 +7,6 @@ use std::str::FromStr; use std::collections::HashMap; use actix::{Arbiter, Addr, Syn, System, SystemRunner, msgs}; -use bytes::Bytes; use cookie::Cookie; use http::{Uri, Method, Version, HeaderMap, HttpTryFrom}; use http::header::{HeaderName, HeaderValue}; @@ -16,6 +15,7 @@ use tokio_core::net::TcpListener; use tokio_core::reactor::Core; use net2::TcpBuilder; +use body::Binary; use error::Error; use handler::{Handler, Responder, ReplyItem}; use middleware::Middleware; @@ -397,9 +397,10 @@ impl TestRequest { } /// Set request payload - pub fn set_payload(mut self, data: Bytes) -> Self { + pub fn set_payload>(mut self, data: B) -> Self { + let mut data = data.into(); let mut payload = Payload::empty(); - payload.unread_data(data); + payload.unread_data(data.take()); self.payload = Some(payload); self }