mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
prepare codegen 0.4.0 release (#1702)
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
use actix_web::*;
|
||||
use actix_web_codegen::*;
|
||||
|
||||
#[route("/", method="GET", method="GET")]
|
||||
async fn index() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn index() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
|
@ -5,7 +5,7 @@ error: HTTP method defined more than once: `GET`
|
||||
| ^^^^^
|
||||
|
||||
error[E0425]: cannot find value `index` in this scope
|
||||
--> $DIR/route-duplicate-method-fail.rs:10:49
|
||||
--> $DIR/route-duplicate-method-fail.rs:12:49
|
||||
|
|
||||
10 | let srv = test::start(|| App::new().service(index));
|
||||
12 | let srv = test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
|
@ -1,15 +0,0 @@
|
||||
use actix_web::*;
|
||||
|
||||
#[route("/")]
|
||||
async fn index() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
let response = request.send().await.unwrap();
|
||||
assert!(response.status().is_success());
|
||||
}
|
@ -0,0 +1 @@
|
||||
route-missing-method-fail.rs
|
@ -5,7 +5,7 @@ error: The #[route(..)] macro requires at least one `method` attribute
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0425]: cannot find value `index` in this scope
|
||||
--> $DIR/route-missing-method-fail-msrv.rs:10:49
|
||||
--> $DIR/route-missing-method-fail-msrv.rs:12:49
|
||||
|
|
||||
10 | let srv = test::start(|| App::new().service(index));
|
||||
12 | let srv = test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
|
@ -1,12 +1,14 @@
|
||||
use actix_web::*;
|
||||
use actix_web_codegen::*;
|
||||
|
||||
#[route("/")]
|
||||
async fn index() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn index() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
|
@ -7,7 +7,7 @@ error: The #[route(..)] macro requires at least one `method` attribute
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0425]: cannot find value `index` in this scope
|
||||
--> $DIR/route-missing-method-fail.rs:10:49
|
||||
--> $DIR/route-missing-method-fail.rs:12:49
|
||||
|
|
||||
10 | let srv = test::start(|| App::new().service(index));
|
||||
12 | let srv = test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
|
@ -1,12 +1,14 @@
|
||||
use actix_web::*;
|
||||
use actix_web_codegen::*;
|
||||
|
||||
#[route("/", method="GET", method="HEAD")]
|
||||
async fn index() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn index() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
|
@ -1,12 +1,14 @@
|
||||
use actix_web::*;
|
||||
use actix_web_codegen::*;
|
||||
|
||||
#[route("/", method="UNEXPECTED")]
|
||||
async fn index() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn index() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
|
@ -5,7 +5,7 @@ error: Unexpected HTTP method: `UNEXPECTED`
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0425]: cannot find value `index` in this scope
|
||||
--> $DIR/route-unexpected-method-fail.rs:10:49
|
||||
--> $DIR/route-unexpected-method-fail.rs:12:49
|
||||
|
|
||||
10 | let srv = test::start(|| App::new().service(index));
|
||||
12 | let srv = test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
|
@ -1,30 +1,30 @@
|
||||
use actix_web::*;
|
||||
use actix_web_codegen::*;
|
||||
|
||||
#[get("/one", other)]
|
||||
async fn one() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn one() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[post(/two)]
|
||||
async fn two() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn two() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
static PATCH_PATH: &str = "/three";
|
||||
|
||||
#[patch(PATCH_PATH)]
|
||||
async fn three() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn three() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[delete("/four", "/five")]
|
||||
async fn four() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn four() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
#[delete("/five", method="GET")]
|
||||
async fn five() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
async fn five() -> String {
|
||||
"Hello World!".to_owned()
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,4 +1,5 @@
|
||||
use actix_web::*;
|
||||
use actix_web::{Responder, HttpResponse, App, test};
|
||||
use actix_web_codegen::*;
|
||||
|
||||
#[get("/config")]
|
||||
async fn config() -> impl Responder {
|
||||
|
Reference in New Issue
Block a user