Skip to content

Commit 330588d

Browse files
authored
Merge pull request #8 from nuclearcat/fix-header-parsing
fix(headers): Split headers properly on multiple :
2 parents daa3d72 + 3f457fe commit 330588d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/azure.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,10 @@ fn get_headers_from_file(filename: String) -> HeaderMap {
149149
let mut headers = HeaderMap::new();
150150
let file_content = read_to_string(filename).unwrap();
151151
for line in file_content.lines() {
152-
// Use the variable here
153-
let parts: Vec<&str> = line.split(":").collect();
154-
if parts.len() == 2 {
155-
let key = HeaderName::from_bytes(parts[0].trim().as_bytes()).unwrap();
156-
let value = HeaderValue::from_str(parts[1].trim()).unwrap();
152+
// Split only on the first ':' so values like times (HH:MM:SS) are preserved
153+
if let Some((name, value)) = line.split_once(':') {
154+
let key = HeaderName::from_bytes(name.trim().as_bytes()).unwrap();
155+
let value = HeaderValue::from_str(value.trim()).unwrap();
157156
headers.insert(key, value);
158157
}
159158
}

0 commit comments

Comments
 (0)