1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 15:39:02 +02:00
This commit is contained in:
Rob Ede
2023-03-13 17:59:23 +00:00
parent 1a3fedc78f
commit 5fa564fd4e
3 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@ use actix_web::{get, App, HttpRequest, HttpServer, Responder};
#[get("/")]
async fn index(req: HttpRequest) -> impl Responder {
let url = req.url_for("youtube", &["oHg5SJYRHA0"]).unwrap();
let url = req.url_for("youtube", ["oHg5SJYRHA0"]).unwrap();
assert_eq!(url.as_str(), "https://youtube.com/watch/oHg5SJYRHA0");
url.to_string()

View File

@ -3,7 +3,7 @@ use actix_web::{get, guard, http::header, HttpRequest, HttpResponse, Result};
#[get("/test/")]
async fn index(req: HttpRequest) -> Result<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
Ok(HttpResponse::Found()
.insert_header((header::LOCATION, url.as_str()))