mirror of
https://github.com/AThilenius/axum-connect.git
synced 2025-01-06 18:18:42 +00:00
Support for Unary-Get-Request
This commit is contained in:
parent
929027e321
commit
b6c11ad2c0
3 changed files with 9 additions and 11 deletions
|
@ -42,6 +42,7 @@ impl AxumConnectServiceGenerator {
|
||||||
|
|
||||||
fn generate_service_method(&mut self, method: Method, path_root: &str) -> TokenStream {
|
fn generate_service_method(&mut self, method: Method, path_root: &str) -> TokenStream {
|
||||||
let method_name = format_ident!("{}", method.name);
|
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 input_type: syn::Type = parse_str(&method.input_type).unwrap();
|
||||||
let output_type: syn::Type = parse_str(&method.output_type).unwrap();
|
let output_type: syn::Type = parse_str(&method.output_type).unwrap();
|
||||||
let path = format!("/{}/{}", path_root, method.proto_name);
|
let path = format!("/{}/{}", path_root, method.proto_name);
|
||||||
|
@ -70,8 +71,6 @@ impl AxumConnectServiceGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let method_name_unary_get = format_ident!("{}_unary_get", method.name);
|
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
pub fn #method_name<T, H, S>(
|
pub fn #method_name<T, H, S>(
|
||||||
handler: H
|
handler: H
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
//!
|
||||||
cargo run -p axum-connect-example
|
//! $ 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%7D' -v
|
||||||
curl 'http://127.0.0.1:3030/hello.HelloWorldService/SayHello?encoding=json&message=%7B%22name%22%3A%22foo%22%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 async_stream::stream;
|
||||||
use axum::{extract::Host, Router};
|
use axum::{extract::Host, Router};
|
||||||
|
|
|
@ -18,12 +18,11 @@ repository = "https://github.com/AThilenius/axum-connect"
|
||||||
async-stream = "0.3.5"
|
async-stream = "0.3.5"
|
||||||
async-trait = "0.1.64"
|
async-trait = "0.1.64"
|
||||||
axum = { version = "0.7.2", features = ["multipart"] }
|
axum = { version = "0.7.2", features = ["multipart"] }
|
||||||
|
base64 = "0.21.5"
|
||||||
futures = "0.3.26"
|
futures = "0.3.26"
|
||||||
pbjson = "0.6.0"
|
pbjson = "0.6.0"
|
||||||
pbjson-types = "0.6.0"
|
pbjson-types = "0.6.0"
|
||||||
prost = "0.12.1"
|
prost = "0.12.1"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
serde_qs = "0.12.0"
|
||||||
serde_qs = { version = "0.12.0" }
|
|
||||||
base64 = { version = "0.21.5" }
|
|
||||||
|
|
Loading…
Reference in a new issue