mirror of
https://github.com/actix/actix-extras.git
synced 2025-01-22 23:05:56 +01:00
update tests
This commit is contained in:
parent
afe9459ce1
commit
d555fcabfc
@ -168,7 +168,7 @@ impl<S> ApplicationBuilder<S> where S: 'static {
|
|||||||
/// impl Route for MyRoute {
|
/// impl Route for MyRoute {
|
||||||
/// type State = ();
|
/// type State = ();
|
||||||
///
|
///
|
||||||
/// fn request(req: HttpRequest,
|
/// fn request(req: &mut HttpRequest,
|
||||||
/// payload: Payload,
|
/// payload: Payload,
|
||||||
/// ctx: &mut HttpContext<Self>) -> Reply<Self> {
|
/// ctx: &mut HttpContext<Self>) -> Reply<Self> {
|
||||||
/// Reply::reply(httpcodes::HTTPOk)
|
/// Reply::reply(httpcodes::HTTPOk)
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
//! impl Route for WsRoute {
|
//! impl Route for WsRoute {
|
||||||
//! type State = ();
|
//! type State = ();
|
||||||
//!
|
//!
|
||||||
//! fn request(req: HttpRequest, payload: Payload, ctx: &mut HttpContext<Self>) -> Reply<Self>
|
//! fn request(req: &mut HttpRequest, payload: Payload, ctx: &mut HttpContext<Self>) -> Reply<Self>
|
||||||
//! {
|
//! {
|
||||||
//! // WebSocket handshake
|
//! // WebSocket handshake
|
||||||
//! match ws::handshake(&req) {
|
//! match ws::handshake(&req) {
|
||||||
|
@ -79,14 +79,14 @@ fn test_request_query() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_request_match_info() {
|
fn test_request_match_info() {
|
||||||
let req = HttpRequest::new(Method::GET, Uri::try_from("/value/?id=test").unwrap(),
|
let mut req = HttpRequest::new(Method::GET, Uri::try_from("/value/?id=test").unwrap(),
|
||||||
Version::HTTP_11, HeaderMap::new());
|
Version::HTTP_11, HeaderMap::new());
|
||||||
|
|
||||||
let rec = RouteRecognizer::new("/".to_owned(), vec![("/{key}/".to_owned(), 1)]);
|
let rec = RouteRecognizer::new("/".to_owned(), vec![("/{key}/".to_owned(), 1)]);
|
||||||
let (params, _) = rec.recognize(req.path()).unwrap();
|
let (params, _) = rec.recognize(req.path()).unwrap();
|
||||||
let params = params.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"));
|
assert_eq!(req.match_info().get("key"), Some("value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user