Skip to main content

caching_post_function

Function caching_post_function 

Source
pub fn caching_post_function(
    url: String,
    transmission_key: TransmissionKey,
    encrypted_payload: EncryptedPayload,
) -> Result<KsmHttpResponse, KSMRError>
Expand description

Caching post function for disaster recovery.

Warning: This bare function builds a new reqwest::blocking::Client on every call. Calling it from inside tokio::task::spawn_blocking will panic with “Cannot drop a runtime in a context where blocking is not allowed”. Use make_caching_post_function instead, which captures a pre-built client.

§Arguments

  • url - The API endpoint URL
  • transmission_key - The transmission key for encryption
  • encrypted_payload - The encrypted payload with signature

§Returns

  • Result<KsmHttpResponse, KSMRError> - Response object (from network or cache)