mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-28 07:20:12 +01:00
Avoid reallocation for String body extraction (#2857)
This commit is contained in:
parent
0ba73b5c6e
commit
f1723890cb
2 changed files with 2 additions and 4 deletions
|
@ -19,7 +19,7 @@ __private_docs = ["dep:tower-http"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.67"
|
async-trait = "0.1.67"
|
||||||
bytes = "1.0"
|
bytes = "1.2"
|
||||||
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
|
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||||
http = "1.0.0"
|
http = "1.0.0"
|
||||||
http-body = "1.0.0"
|
http-body = "1.0.0"
|
||||||
|
|
|
@ -137,9 +137,7 @@ where
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let string = std::str::from_utf8(&bytes)
|
let string = String::from_utf8(bytes.into()).map_err(InvalidUtf8::from_err)?;
|
||||||
.map_err(InvalidUtf8::from_err)?
|
|
||||||
.to_owned();
|
|
||||||
|
|
||||||
Ok(string)
|
Ok(string)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue