Skip to content

Commit

Permalink
fix: skip leading whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
polachok committed May 25, 2022
1 parent f2025ce commit 8a723af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/http_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ pub async fn read_body(
return Err(GenericTransportError::TooLarge);
}

let single = match first_chunk.get(0) {
let first_non_whitespace = first_chunk.iter().find(|byte| !byte.is_ascii_whitespace());

let single = match first_non_whitespace {
Some(b'{') => true,
Some(b'[') => false,
_ => return Err(GenericTransportError::Malformed),
Expand Down

0 comments on commit 8a723af

Please sign in to comment.