Avoid reallocation for String body extraction (#2857)

This commit is contained in:
yhx-12243
2024-09-20 21:02:52 +02:00
committed by GitHub
parent 352b7cf044
commit 42003c08b5
2 changed files with 2 additions and 4 deletions
+1 -3
View File
@@ -137,9 +137,7 @@ where
}
})?;
let string = std::str::from_utf8(&bytes)
.map_err(InvalidUtf8::from_err)?
.to_owned();
let string = String::from_utf8(bytes.into()).map_err(InvalidUtf8::from_err)?;
Ok(string)
}