Support tab after HTTP version

This commit is contained in:
Fabrice Reix 2024-04-18 16:07:33 +02:00 committed by hurl-bot
parent c672529b8c
commit ae29d8afe1
No known key found for this signature in database
GPG Key ID: 1283A2B4A0DCAF8D

View File

@ -154,7 +154,7 @@ fn version(reader: &mut Reader) -> ParseResult<Version> {
}
Err(Error::new(start.pos, false, ParseError::Version))
}
Some(' ') => Ok(Version {
Some(' ') | Some('\t') => Ok(Version {
value: VersionAny,
source_info: SourceInfo::new(start.pos, reader.state.pos),
}),
@ -480,6 +480,20 @@ mod tests {
#[test]
fn test_version() {
let mut reader = Reader::new("HTTP 200");
assert_eq!(
version(&mut reader).unwrap().value,
VersionValue::VersionAny
);
assert_eq!(reader.state.cursor, 4);
let mut reader = Reader::new("HTTP\t200");
assert_eq!(
version(&mut reader).unwrap().value,
VersionValue::VersionAny
);
assert_eq!(reader.state.cursor, 4);
let mut reader = Reader::new("HTTP/1.1 200");
assert_eq!(version(&mut reader).unwrap().value, VersionValue::Version11);