mirror of
https://github.com/actix/actix-web.git
synced 2024-11-03 15:39:50 +00:00
allow to pass different binary data
This commit is contained in:
parent
979cea03ac
commit
3f95cce9e8
1 changed files with 4 additions and 3 deletions
|
@ -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<S> TestRequest<S> {
|
|||
}
|
||||
|
||||
/// Set request payload
|
||||
pub fn set_payload(mut self, data: Bytes) -> Self {
|
||||
pub fn set_payload<B: Into<Binary>>(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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue