Skip to content

Commit

Permalink
Port Null transform to use MessageId (#1497)
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Feb 23, 2024
1 parent a8ba522 commit 9c9dfb6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shotover/src/transforms/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ impl Transform for NullSink {

async fn transform<'a>(&'a mut self, mut requests_wrapper: Wrapper<'a>) -> Result<Messages> {
for message in &mut requests_wrapper.requests {
let request_id = message.id();

// reuse the requests to hold the responses to avoid an allocation
*message =
message.to_error_response("Handled by shotover null transform".to_string())?;

// set the response to point to its corresponding request
message.set_request_id(request_id)
}
Ok(requests_wrapper.requests)
}
Expand Down

0 comments on commit 9c9dfb6

Please sign in to comment.