mirror of
https://github.com/AThilenius/axum-connect.git
synced 2024-11-24 06:19:46 +00:00
Fixed the bug of message decode in Unary-Request
This commit is contained in:
parent
d961cf16af
commit
cd33439672
1 changed files with 4 additions and 4 deletions
|
@ -216,7 +216,7 @@ where
|
|||
use base64::{engine::general_purpose, Engine as _};
|
||||
|
||||
match general_purpose::URL_SAFE.decode(&query.message) {
|
||||
Ok(x) => String::from_utf8_lossy(x.as_slice()).to_string(),
|
||||
Ok(x) => x,
|
||||
Err(err) => {
|
||||
return Err(encode_error_response(
|
||||
&RpcError::new(
|
||||
|
@ -229,11 +229,11 @@ where
|
|||
}
|
||||
}
|
||||
} else {
|
||||
query.message.into()
|
||||
query.message.as_bytes().to_vec()
|
||||
};
|
||||
|
||||
if as_binary {
|
||||
let message: M = M::decode(message.as_bytes()).map_err(|e| {
|
||||
let message: M = M::decode(&message[..]).map_err(|e| {
|
||||
encode_error_response(
|
||||
&RpcError::new(
|
||||
RpcErrorCode::InvalidArgument,
|
||||
|
@ -246,7 +246,7 @@ where
|
|||
|
||||
Ok(message)
|
||||
} else {
|
||||
let message: M = serde_json::from_str(&message).map_err(|e| {
|
||||
let message: M = serde_json::from_slice(&message).map_err(|e| {
|
||||
encode_error_response(
|
||||
&RpcError::new(
|
||||
RpcErrorCode::InvalidArgument,
|
||||
|
|
Loading…
Reference in a new issue