1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-18 05:41:50 +01:00

update tests

This commit is contained in:
Nikolay Kim 2017-12-15 18:49:11 -08:00
parent 1ddcce7b76
commit a8b2f1b821
3 changed files with 4 additions and 4 deletions

View File

@ -112,14 +112,14 @@ mod tests {
let mut req = HttpRequest::default(); let mut req = HttpRequest::default();
let resp = HttpResponse::Ok().finish().unwrap(); let resp = HttpResponse::Ok().finish().unwrap();
let resp = match mw.response(&mut req, Box::new(resp)) { let resp = match mw.response(&mut req, resp) {
Response::Done(resp) => resp, Response::Done(resp) => resp,
_ => panic!(), _ => panic!(),
}; };
assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "0001"); assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "0001");
let resp = HttpResponse::Ok().header(CONTENT_TYPE, "0002").finish().unwrap(); let resp = HttpResponse::Ok().header(CONTENT_TYPE, "0002").finish().unwrap();
let resp = match mw.response(&mut req, Box::new(resp)) { let resp = match mw.response(&mut req, resp) {
Response::Done(resp) => resp, Response::Done(resp) => resp,
_ => panic!(), _ => panic!(),
}; };

View File

@ -899,7 +899,7 @@ mod tests {
let mut ctx = HttpContext::new(req.clone(), MyActor); let mut ctx = HttpContext::new(req.clone(), MyActor);
let addr: Address<_> = ctx.address(); let addr: Address<_> = ctx.address();
let mut info = PipelineInfo::new(req); let mut info = PipelineInfo::new(req);
info.context = Some(ctx); info.context = Some(Box::new(ctx));
let mut state = Completed::init(&mut info).completed().unwrap(); let mut state = Completed::init(&mut info).completed().unwrap();
let st = state.poll(&mut info).ok().unwrap(); let st = state.poll(&mut info).ok().unwrap();

View File

@ -59,7 +59,7 @@ impl<S> middlewares::Middleware<S> for MiddlewareTest {
middlewares::Started::Done middlewares::Started::Done
} }
fn response(&self, _: &mut HttpRequest<S>, resp: Box<HttpResponse>) -> middlewares::Response { fn response(&self, _: &mut HttpRequest<S>, resp: HttpResponse) -> middlewares::Response {
self.response.store(self.response.load(Ordering::Relaxed) + 1, Ordering::Relaxed); self.response.store(self.response.load(Ordering::Relaxed) + 1, Ordering::Relaxed);
middlewares::Response::Done(resp) middlewares::Response::Done(resp)
} }