1
0
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:
Rob Ede
2020-09-24 23:54:01 +01:00
committed by GitHub
parent 162121bf8d
commit c53e9468bc
14 changed files with 124 additions and 69 deletions

View File

@ -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("/");

View File

@ -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

View File

@ -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());
}

View File

@ -0,0 +1 @@
route-missing-method-fail.rs

View File

@ -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

View File

@ -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("/");

View File

@ -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

View File

@ -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("/");

View File

@ -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("/");

View File

@ -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

View File

@ -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() {}

View File

@ -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 {