Fix: Use HttpError struct for error handling where a non-compliant string was returned
This commit is contained in:
parent
18b2521a93
commit
b5e086bd0a
2 changed files with 4 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ use axum::{
|
|||
use log::*;
|
||||
use tower::Service;
|
||||
|
||||
use crate::storage::DatabaseDriver;
|
||||
use crate::{common::HttpError, storage::DatabaseDriver};
|
||||
|
||||
#[derive(Clone)]
|
||||
/// State to be used to store the database pool
|
||||
|
|
@ -47,7 +47,7 @@ async fn engine_handler(
|
|||
}
|
||||
} else {
|
||||
// Otherwise, the mount path could not be found
|
||||
(StatusCode::NOT_FOUND, "Mount path not found").into_response()
|
||||
HttpError::simple(StatusCode::NOT_FOUND, "Secret engine mount path not found")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,9 +66,9 @@ async fn call_router(engine: Router, mount_path: String, mut req: Request) -> Re
|
|||
/// HTTP error response for unknown engine types
|
||||
/// Occurs when the mount path is found in the database
|
||||
/// but the registered is unknown
|
||||
fn unknown_engine(engine_type: String) -> (StatusCode, String) {
|
||||
fn unknown_engine(engine_type: String) -> impl IntoResponse {
|
||||
error!("Engine type {} not implemented", engine_type);
|
||||
(
|
||||
HttpError::simple(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Engine type {} not implemented", engine_type),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zeroize::ZeroizeOnDrop;
|
||||
use std::{collections::HashMap, vec};
|
||||
|
||||
pub type KvSecretData = HashMap<String, String>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue