| 84 | } |
| 85 | |
| 86 | pub async fn handle_request(b: Bytes) -> Response { |
| 87 | let b: Vec<u8> = b.into(); |
| 88 | |
| 89 | let bp: BasePayload = match serde_json::from_slice(&b) { |
| 90 | Ok(v) => v, |
| 91 | Err(e) => { |
| 92 | return (StatusCode::BAD_REQUEST, e.to_string()).into_response(); |
| 93 | } |
| 94 | }; |
| 95 | |
| 96 | let span = span!(Level::INFO, "request", sender_id = %hex::encode(&bp.sender_id), receiver_id = %hex::encode(&bp.receiver_id), message_type = ?bp.message_type, transaction_id = bp.transaction_id); |
| 97 | _handle_request(bp, b).instrument(span).await |
| 98 | } |
| 99 | |
| 100 | pub async fn _handle_request(bp: BasePayload, b: Vec<u8>) -> Response { |
| 101 | info!("Request received"); |