Support for Unary-Get-Request

This commit is contained in:
vkill 2024-01-08 17:12:40 +08:00 committed by Alec Thilenius
parent 929027e321
commit b6c11ad2c0
3 changed files with 9 additions and 11 deletions

View file

@ -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<T, H, S>(
handler: H

View file

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

View file

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