mirror of https://github.com/rwf2/Rocket.git
List all valid methods in codegen error message.
This commit is contained in:
parent
1ae1bfc101
commit
94534c3895
|
@ -164,8 +164,9 @@ pub fn param_to_ident(ecx: &ExtCtxt, s: Spanned<&str>) -> Option<Spanned<Ident>>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_method(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<Method> {
|
fn parse_method(ecx: &ExtCtxt, meta_item: &NestedMetaItem) -> Spanned<Method> {
|
||||||
let valid_methods = "valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `PATCH`";
|
|
||||||
let default_method = dummy_spanned(Method::Get);
|
let default_method = dummy_spanned(Method::Get);
|
||||||
|
let valid_methods = "valid methods are: `GET`, `PUT`, `POST`, `DELETE`, \
|
||||||
|
`HEAD`, `PATCH`, `OPTIONS`";
|
||||||
|
|
||||||
if let Some(word) = meta_item.word() {
|
if let Some(word) = meta_item.word() {
|
||||||
if let Ok(method) = Method::from_str(&word.name().as_str()) {
|
if let Ok(method) = Method::from_str(&word.name().as_str()) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: 'FIX' is not a valid method
|
||||||
6 | #[route(FIX, "/hello")]
|
6 | #[route(FIX, "/hello")]
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `PATCH`
|
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS`
|
||||||
|
|
||||||
error: expected a valid HTTP method identifier
|
error: expected a valid HTTP method identifier
|
||||||
--> $DIR/route-bad-method.rs:9:9
|
--> $DIR/route-bad-method.rs:9:9
|
||||||
|
@ -12,7 +12,7 @@ error: expected a valid HTTP method identifier
|
||||||
9 | #[route("hi", "/hello")]
|
9 | #[route("hi", "/hello")]
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `PATCH`
|
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS`
|
||||||
|
|
||||||
error: expected a valid HTTP method identifier
|
error: expected a valid HTTP method identifier
|
||||||
--> $DIR/route-bad-method.rs:12:9
|
--> $DIR/route-bad-method.rs:12:9
|
||||||
|
@ -20,7 +20,7 @@ error: expected a valid HTTP method identifier
|
||||||
12 | #[route("GET", "/hello")]
|
12 | #[route("GET", "/hello")]
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `PATCH`
|
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS`
|
||||||
|
|
||||||
error: expected a valid HTTP method identifier
|
error: expected a valid HTTP method identifier
|
||||||
--> $DIR/route-bad-method.rs:15:9
|
--> $DIR/route-bad-method.rs:15:9
|
||||||
|
@ -28,7 +28,7 @@ error: expected a valid HTTP method identifier
|
||||||
15 | #[route(120, "/hello")]
|
15 | #[route(120, "/hello")]
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `PATCH`
|
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS`
|
||||||
|
|
||||||
error: 'CONNECT' is not a valid method
|
error: 'CONNECT' is not a valid method
|
||||||
--> $DIR/route-bad-method.rs:18:9
|
--> $DIR/route-bad-method.rs:18:9
|
||||||
|
@ -36,7 +36,7 @@ error: 'CONNECT' is not a valid method
|
||||||
18 | #[route(CONNECT, "/hello")]
|
18 | #[route(CONNECT, "/hello")]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
|
||||||
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `PATCH`
|
= help: valid methods are: `GET`, `PUT`, `POST`, `DELETE`, `HEAD`, `PATCH`, `OPTIONS`
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue