diff --git a/src/main.rs b/src/main.rs index f5fcc90..b678a93 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #![feature(lazy_cell, try_blocks)] -use actix_web::{get, http::header, web, App, Either, HttpResponse, HttpServer}; +use actix_web::{http::header, route, web, App, Either, HttpResponse, HttpServer}; use data::{Card, CardInfo, Set}; use filter::SearchCard; use itertools::Itertools; @@ -113,7 +113,7 @@ fn footer() -> String { ) } -#[get("/")] +#[route("/", method = "GET", method = "HEAD")] async fn search(q: Option, web::Form>>) -> AnyResult { let q = match q { Some(Either::Left(web::Query(Query { q }))) => Some(q), @@ -143,7 +143,7 @@ async fn search(q: Option, web::Form>>) -> AnyRe } } -#[get("/card/{id}")] +#[route("/card/{id}", method = "GET", method = "HEAD")] async fn card_info(card_id: web::Path) -> AnyResult { let mut res = String::with_capacity(2_000); let data = match CARDS_BY_ID.get(&card_id) { @@ -170,7 +170,7 @@ async fn card_info(card_id: web::Path) -> AnyResult { Ok(HttpResponse::Ok().insert_header(header::ContentType::html()).body(res)) } -#[get("/help")] +#[route("/help", method = "GET", method = "HEAD")] async fn help() -> AnyResult { let mut res = String::with_capacity(HEADER.len() + HELP_CONTENT.len() + 500); let data = PageData {