1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-27 15:29:03 +02:00

update extractor tests

This commit is contained in:
Nikolay Kim
2019-03-02 22:03:45 -08:00
parent 352e7b7a75
commit d5c54a1867
6 changed files with 97 additions and 146 deletions

View File

@ -138,7 +138,7 @@ mod tests {
use actix_service::FnService;
use super::*;
use crate::test::TestServiceRequest;
use crate::test::TestRequest;
use crate::{HttpResponse, ServiceRequest};
#[test]
@ -149,11 +149,11 @@ mod tests {
req.into_response(HttpResponse::Ok().finish())
});
let req = TestServiceRequest::default().finish();
let req = TestRequest::default().finish();
let resp = rt.block_on(mw.call(req, &mut srv)).unwrap();
assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "0001");
let req = TestServiceRequest::default().finish();
let req = TestRequest::default().finish();
let mut srv = FnService::new(|req: ServiceRequest<_>| {
req.into_response(HttpResponse::Ok().header(CONTENT_TYPE, "0002").finish())
});
@ -169,7 +169,7 @@ mod tests {
req.into_response(HttpResponse::Ok().finish())
});
let req = TestServiceRequest::default().finish();
let req = TestRequest::default().finish();
let resp = rt.block_on(mw.call(req, &mut srv)).unwrap();
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),

View File

@ -34,19 +34,6 @@ where
}
}
impl<T, S> Clone for MiddlewareFactory<T, S>
where
T: Transform<S> + Clone,
S: Service,
{
fn clone(&self) -> Self {
Self {
tr: self.tr.clone(),
_t: PhantomData,
}
}
}
impl<T, S, C> NewTransform<S, C> for MiddlewareFactory<T, S>
where
T: Transform<S> + Clone,