fix: redis, /get & /post parsing #15

Merged
nm17 merged 4 commits from dev/dc09 into master 2024-06-03 16:23:02 +03:00
2 changed files with 2 additions and 8 deletions
Showing only changes of commit 19a4e0c299 - Show all commits

View file

@ -45,7 +45,7 @@ pub enum AppError {
}, },
#[display(fmt = "UTF8")] #[display(fmt = "UTF8")]
Utf8Error(std::str::Utf8Error), Utf8Error(#[from] std::str::Utf8Error),
#[display(fmt = "IDK")] #[display(fmt = "IDK")]
UnknownBody { UnknownBody {

View file

@ -5,7 +5,6 @@ pub mod qs_parser;
use crate::ingest_protocol::NMJsonPacket; use crate::ingest_protocol::NMJsonPacket;
use crate::web_server::app_error::AppError; use crate::web_server::app_error::AppError;
use bstr::ByteSlice;
use ntex::http::{HttpMessage, StatusCode}; use ntex::http::{HttpMessage, StatusCode};
use ntex::util::Bytes; use ntex::util::Bytes;
use ntex::web::types::State; use ntex::web::types::State;
@ -50,12 +49,7 @@ pub async fn device_handler<'a>(
Err(error) => json_error = Some(error), Err(error) => json_error = Some(error),
}, },
"application/x-www-form-urlencoded" => { "application/x-www-form-urlencoded" => {
let body = match std::str::from_utf8(body.as_ref()) { let body = std::str::from_utf8(body.as_ref())?;
Ok(body) => body,
Err(error) => {
return Err(AppError::Utf8Error(error));
}
};
match qs_parser::parse_nm_qs_format(body).await { match qs_parser::parse_nm_qs_format(body).await {
Ok(qs_body) => { Ok(qs_body) => {
real_body = Some(NMJsonPacket { real_body = Some(NMJsonPacket {