Switch other spawn blocking call oops

This commit is contained in:
asonix 2020-09-29 20:05:42 -05:00
parent 88a7ecce0d
commit ce881b18e1
3 changed files with 8 additions and 3 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "http-signature-normalization-reqwest"
description = "An HTTP Signatures library that leaves the signing to you"
version = "0.1.2"
version = "0.1.3"
authors = ["asonix <asonix@asonix.dog>"]
license-file = "LICENSE"
readme = "README.md"

View file

@ -14,7 +14,7 @@ This crate provides extensions the RequestBuilder type from reqwest
#### First, add this crate to your dependencies
```toml
thiserror = "0.1"
http-signature-normalization-reqwest = { version = "0.1.1", default-features = false, features = ["sha-2"] }
http-signature-normalization-reqwest = { version = "0.1.3", default-features = false, features = ["sha-2"] }
sha2 = "0.9"
```

View file

@ -105,7 +105,12 @@ impl SignExt for RequestBuilder {
Self: Sized,
{
Box::pin(async move {
let digest = tokio::task::block_in_place(|| digest.compute(v.as_ref()));
let (v, digest) = tokio::task::spawn_blocking(move || {
let digest = digest.compute(v.as_ref());
(v, digest)
})
.await
.map_err(|_| SignError::Canceled)?;
let c = self
.header("Digest", format!("{}={}", D::NAME, digest))