mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-30 18:34:36 +01:00
Merge branch 'master' into payload_err
This commit is contained in:
commit
913dce0a72
@ -283,9 +283,9 @@ impl<S> HttpRequest<S> {
|
|||||||
/// Generate url for named resource
|
/// Generate url for named resource
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # extern crate actix_web;
|
/// //#### # extern crate actix_web;
|
||||||
/// # use actix_web::{App, HttpRequest, HttpResponse, http};
|
/// //#### # use actix_web::{App, HttpRequest, HttpResponse, http};
|
||||||
/// #
|
/// //#### #
|
||||||
/// fn index(req: HttpRequest) -> HttpResponse {
|
/// fn index(req: HttpRequest) -> HttpResponse {
|
||||||
/// let url = req.url_for("foo", &["1", "2", "3"]); // <- generate url for "foo" resource
|
/// let url = req.url_for("foo", &["1", "2", "3"]); // <- generate url for "foo" resource
|
||||||
/// HttpResponse::Ok().into()
|
/// HttpResponse::Ok().into()
|
||||||
@ -311,7 +311,6 @@ impl<S> HttpRequest<S> {
|
|||||||
Err(UrlGenerationError::RouterNotAvailable)
|
Err(UrlGenerationError::RouterNotAvailable)
|
||||||
} else {
|
} else {
|
||||||
let path = self.router().unwrap().resource_path(name, elements)?;
|
let path = self.router().unwrap().resource_path(name, elements)?;
|
||||||
println!("==== {:?}", path);
|
|
||||||
if path.starts_with('/') {
|
if path.starts_with('/') {
|
||||||
let conn = self.connection_info();
|
let conn = self.connection_info();
|
||||||
Ok(Url::parse(&format!(
|
Ok(Url::parse(&format!(
|
||||||
|
@ -211,8 +211,6 @@ impl Resource {
|
|||||||
let (pattern, elements, is_dynamic, len) =
|
let (pattern, elements, is_dynamic, len) =
|
||||||
Resource::parse(path, prefix, for_prefix);
|
Resource::parse(path, prefix, for_prefix);
|
||||||
|
|
||||||
println!("ELEMENT: {:?} {:?} {:?}", pattern, elements, is_dynamic);
|
|
||||||
|
|
||||||
let tp = if is_dynamic {
|
let tp = if is_dynamic {
|
||||||
let re = match Regex::new(&pattern) {
|
let re = match Regex::new(&pattern) {
|
||||||
Ok(re) => re,
|
Ok(re) => re,
|
||||||
@ -347,7 +345,6 @@ impl Resource {
|
|||||||
let mut path = String::new();
|
let mut path = String::new();
|
||||||
let mut iter = elements.into_iter();
|
let mut iter = elements.into_iter();
|
||||||
for el in &self.elements {
|
for el in &self.elements {
|
||||||
println!("EL: {:?}", el);
|
|
||||||
match *el {
|
match *el {
|
||||||
PatternElement::Str(ref s) => path.push_str(s),
|
PatternElement::Str(ref s) => path.push_str(s),
|
||||||
PatternElement::Var(_) => {
|
PatternElement::Var(_) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user