Skip to content

Commit

Permalink
re-assign req when polling frame
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRollen committed Apr 19, 2024
1 parent 2351cc9 commit b4a3e35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tower-github-webhook"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
authors = ["Sebastian Rollén <[email protected]>"]
license = "MIT"
Expand Down
11 changes: 9 additions & 2 deletions src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use pin_project::pin_project;
use sha2::Sha256;
use std::future::Future;
use std::pin::Pin;
use std::task::{ready, Context, Poll};
use std::task::{Context, Poll};
use tower::Service;

#[pin_project]
Expand Down Expand Up @@ -98,7 +98,14 @@ where
if body.is_end_stream() {
curr_state.set(ValidateGitHubWebhookFutureState::ValidateSignature);
} else {
let frame = ready!(Pin::new(req.body_mut()).poll_frame(cx));
let frame = match Pin::new(req.body_mut()).poll_frame(cx) {
Poll::Pending => {
*this.req = Some(req);
return Poll::Pending;
}
Poll::Ready(frame) => frame,
};

if let Some(Ok(frame)) = frame {
if let Ok(data) = frame.into_data() {
let mut hmac = this.hmac.take().unwrap();
Expand Down

0 comments on commit b4a3e35

Please sign in to comment.