diff --git a/axum-connect-build/src/gen.rs b/axum-connect-build/src/gen.rs index f3f33fc..c39caa9 100644 --- a/axum-connect-build/src/gen.rs +++ b/axum-connect-build/src/gen.rs @@ -42,6 +42,7 @@ impl AxumConnectServiceGenerator { fn generate_service_method(&mut self, method: Method, path_root: &str) -> TokenStream { let method_name = format_ident!("{}", method.name); + let method_name_unary_get = format_ident!("{}_unary_get", method.name); let input_type: syn::Type = parse_str(&method.input_type).unwrap(); let output_type: syn::Type = parse_str(&method.output_type).unwrap(); let path = format!("/{}/{}", path_root, method.proto_name); @@ -70,8 +71,6 @@ impl AxumConnectServiceGenerator { } } } else { - let method_name_unary_get = format_ident!("{}_unary_get", method.name); - quote! { pub fn #method_name( handler: H diff --git a/axum-connect-examples/src/main.rs b/axum-connect-examples/src/main.rs index cec9c87..4ca77c4 100644 --- a/axum-connect-examples/src/main.rs +++ b/axum-connect-examples/src/main.rs @@ -1,9 +1,9 @@ -/* -cargo run -p axum-connect-example - -curl 'http://127.0.0.1:3030/hello.HelloWorldService/SayHello?encoding=json&message=%7B%7D' -v -curl 'http://127.0.0.1:3030/hello.HelloWorldService/SayHello?encoding=json&message=%7B%22name%22%3A%22foo%22%7D' -v -*/ +//! +//! $ cargo run -p axum-connect-example +//! +//! $ curl 'http://127.0.0.1:3030/hello.HelloWorldService/SayHello?encoding=json&message=%7B%7D' -v +//! $ curl 'http://127.0.0.1:3030/hello.HelloWorldService/SayHello?encoding=json&message=%7B%22name%22%3A%22foo%22%7D' -v +//! use async_stream::stream; use axum::{extract::Host, Router}; diff --git a/axum-connect/Cargo.toml b/axum-connect/Cargo.toml index 85d5c85..f12b9db 100644 --- a/axum-connect/Cargo.toml +++ b/axum-connect/Cargo.toml @@ -18,12 +18,11 @@ repository = "https://github.com/AThilenius/axum-connect" async-stream = "0.3.5" async-trait = "0.1.64" axum = { version = "0.7.2", features = ["multipart"] } +base64 = "0.21.5" futures = "0.3.26" pbjson = "0.6.0" pbjson-types = "0.6.0" prost = "0.12.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" - -serde_qs = { version = "0.12.0" } -base64 = { version = "0.21.5" } +serde_qs = "0.12.0"