MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / handle_request

Function handle_request

chirpstack/src/api/backend/mod.rs:86–98  ·  view source on GitHub ↗
(b: Bytes)

Source from the content-addressed store, hash-verified

84}
85
86pub 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
100pub async fn _handle_request(bp: BasePayload, b: Vec<u8>) -> Response {
101 info!("Request received");

Callers 5

test_snsFunction · 0.85
test_sns_uplinkFunction · 0.85
test_sns_dev_not_foundFunction · 0.85

Calls 3

_handle_requestFunction · 0.85
to_stringMethod · 0.80
intoMethod · 0.45

Tested by 5

test_snsFunction · 0.68
test_sns_uplinkFunction · 0.68
test_sns_dev_not_foundFunction · 0.68