Skip to content

Commit

Permalink
Fix middleware not triggered when requesting raw
Browse files Browse the repository at this point in the history
  • Loading branch information
bytedream committed Dec 9, 2023
1 parent 355c839 commit 7346479
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/crunchyroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,21 @@ mod auth {
}

pub(crate) async fn request_raw(self) -> Result<Vec<u8>> {
Ok(self.builder.send().await?.bytes().await?.to_vec())
#[cfg(not(feature = "tower"))]
return Ok(self.builder.send().await?.bytes().await?.to_vec());
#[cfg(feature = "tower")]
if let Some(middleware) = &self.executor.middleware {
Ok(middleware
.lock()
.await
.call(self.builder.build()?)
.await?
.bytes()
.await?
.to_vec())
} else {
Ok(self.builder.send().await?.bytes().await?.to_vec())
}
}
}

Expand Down

0 comments on commit 7346479

Please sign in to comment.