From 779f8ea83e68f0dfc4c2037991277530ff83f581 Mon Sep 17 00:00:00 2001 From: Ovidiu Gheorghies Date: Sat, 30 Jul 2022 20:19:42 +0300 Subject: [PATCH] Change method from GET to POST (#277) Co-authored-by: Rob Ede --- examples/extractors/src/json_one.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/extractors/src/json_one.rs b/examples/extractors/src/json_one.rs index 46882cc..95453df 100644 --- a/examples/extractors/src/json_one.rs +++ b/examples/extractors/src/json_one.rs @@ -1,5 +1,5 @@ // -use actix_web::{get, web, App, HttpServer, Result}; +use actix_web::{post, web, App, HttpServer, Result}; use serde::Deserialize; #[derive(Deserialize)] @@ -8,15 +8,15 @@ struct Info { } /// deserialize `Info` from request's body -#[get("/")] -async fn index(info: web::Json) -> Result { +#[post("/submit")] +async fn submit(info: web::Json) -> Result { Ok(format!("Welcome {}!", info.username)) } // #[actix_web::main] async fn main() -> std::io::Result<()> { - HttpServer::new(|| App::new().service(index)) + HttpServer::new(|| App::new().service(submit)) .bind(("127.0.0.1", 8080))? .run() .await