mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 02:17:46 +08:00
feat(routing): make client disconnect behavior strategy-scoped
This commit is contained in:
@@ -20,6 +20,14 @@ use super::{
|
||||
const UPSTREAM_IS_STREAM_KEY: &str = "upstream_is_stream";
|
||||
const PLAN_USAGE_RESERVATION_TOKEN_KEY: &str = "plan_usage_reservation_token";
|
||||
const BODY_SIZE_BASIS: &str = "serialized gateway request bodies after normalization";
|
||||
pub const CANCELLED_REQUEST_FEE_METADATA_KEY: &str = "cancelled_request_fee";
|
||||
|
||||
pub fn cancelled_request_fee_is_billable(metadata: Option<&Value>) -> bool {
|
||||
metadata
|
||||
.and_then(|metadata| metadata.get(CANCELLED_REQUEST_FEE_METADATA_KEY))
|
||||
.and_then(Value::as_bool)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Projects request metadata onto the persistence contract. Unknown fields and malformed values
|
||||
/// are discarded instead of being recursively copied into an audit row.
|
||||
@@ -48,6 +56,7 @@ pub fn sanitize_usage_request_metadata_object(source: &Map<String, Value>) -> Op
|
||||
PLAN_USAGE_RESERVATION_DEFERRED_METADATA_KEY,
|
||||
"transport_error",
|
||||
"is_free_tier",
|
||||
CANCELLED_REQUEST_FEE_METADATA_KEY,
|
||||
USAGE_AVAILABLE_METADATA_KEY,
|
||||
USAGE_PRICING_AVAILABLE_METADATA_KEY,
|
||||
] {
|
||||
|
||||
Reference in New Issue
Block a user