fix(codec): Remove custom content-type (#104)
This removes custom content-types in favor of just using `application/grpc`. There is some confusion around the specification but most grpc implementations ignore the `+` and anything after.
This commit is contained in:
@@ -104,7 +104,7 @@ fn generate_unary(method: &Method, proto: &str, path: String) -> TokenStream {
|
||||
request: impl tonic::IntoRequest<#request>,
|
||||
) -> Result<tonic::Response<#response>, tonic::Status> {
|
||||
self.ready().await?;
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.unary(request.into_request(), path, codec).await
|
||||
}
|
||||
@@ -122,7 +122,7 @@ fn generate_server_streaming(method: &Method, proto: &str, path: String) -> Toke
|
||||
request: impl tonic::IntoRequest<#request>,
|
||||
) -> Result<tonic::Response<tonic::codec::Streaming<#response>>, tonic::Status> {
|
||||
self.ready().await?;
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.server_streaming(request.into_request(), path, codec).await
|
||||
}
|
||||
@@ -140,7 +140,7 @@ fn generate_client_streaming(method: &Method, proto: &str, path: String) -> Toke
|
||||
request: impl tonic::IntoStreamingRequest<Message = #request>
|
||||
) -> Result<tonic::Response<#response>, tonic::Status> {
|
||||
self.ready().await?;
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.client_streaming(request.into_streaming_request(), path, codec).await
|
||||
}
|
||||
@@ -158,7 +158,7 @@ fn generate_streaming(method: &Method, proto: &str, path: String) -> TokenStream
|
||||
request: impl tonic::IntoStreamingRequest<Message = #request>
|
||||
) -> Result<tonic::Response<tonic::codec::Streaming<#response>>, tonic::Status> {
|
||||
self.ready().await?;
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.streaming(request.into_streaming_request(), path, codec).await
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ fn generate_unary(
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let method = #service_ident(inner);
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec);
|
||||
let res = grpc.unary(method, req).await;
|
||||
Ok(res)
|
||||
@@ -289,7 +289,7 @@ fn generate_server_streaming(
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let method = #service_ident(inner);
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec);
|
||||
let res = grpc.server_streaming(method, req).await;
|
||||
Ok(res)
|
||||
@@ -330,7 +330,7 @@ fn generate_client_streaming(
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let method = #service_ident(inner);
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec);
|
||||
let res = grpc.client_streaming(method, req).await;
|
||||
Ok(res)
|
||||
@@ -373,7 +373,7 @@ fn generate_streaming(
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let method = #service_ident(inner);
|
||||
let codec = tonic::codec::ProstCodec::new();
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec);
|
||||
let res = grpc.streaming(method, req).await;
|
||||
Ok(res)
|
||||
|
||||
Reference in New Issue
Block a user