From d555fcabfc19472a1244c5581920151752b2e738 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 22 Oct 2017 08:14:23 -0700 Subject: [PATCH] update tests --- src/application.rs | 2 +- src/ws.rs | 2 +- tests/test_httprequest.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/application.rs b/src/application.rs index 95ff8d47..de77317d 100644 --- a/src/application.rs +++ b/src/application.rs @@ -168,7 +168,7 @@ impl ApplicationBuilder where S: 'static { /// impl Route for MyRoute { /// type State = (); /// - /// fn request(req: HttpRequest, + /// fn request(req: &mut HttpRequest, /// payload: Payload, /// ctx: &mut HttpContext) -> Reply { /// Reply::reply(httpcodes::HTTPOk) diff --git a/src/ws.rs b/src/ws.rs index fb4d3b10..7dbae44f 100644 --- a/src/ws.rs +++ b/src/ws.rs @@ -22,7 +22,7 @@ //! impl Route for WsRoute { //! type State = (); //! -//! fn request(req: HttpRequest, payload: Payload, ctx: &mut HttpContext) -> Reply +//! fn request(req: &mut HttpRequest, payload: Payload, ctx: &mut HttpContext) -> Reply //! { //! // WebSocket handshake //! match ws::handshake(&req) { diff --git a/tests/test_httprequest.rs b/tests/test_httprequest.rs index d2577884..0e57adc0 100644 --- a/tests/test_httprequest.rs +++ b/tests/test_httprequest.rs @@ -79,14 +79,14 @@ fn test_request_query() { #[test] fn test_request_match_info() { - let req = HttpRequest::new(Method::GET, Uri::try_from("/value/?id=test").unwrap(), - Version::HTTP_11, HeaderMap::new()); + let mut req = HttpRequest::new(Method::GET, Uri::try_from("/value/?id=test").unwrap(), + Version::HTTP_11, HeaderMap::new()); let rec = RouteRecognizer::new("/".to_owned(), vec![("/{key}/".to_owned(), 1)]); let (params, _) = rec.recognize(req.path()).unwrap(); let params = params.unwrap(); - let req = req.with_match_info(params); + req.set_match_info(params); assert_eq!(req.match_info().get("key"), Some("value")); }