History

adjust expectations to deal with reqwest Content-Length

In short, reqwest sends a `content-length: 0` header in GET requests for a reason maybe related to this issue: https://github.com/seanmonstar/reqwest/issues/1971 For now, let's ignore Content-Length header lines.

Sebastian Thiel committed 2 years ago

Commit 3b8f39d1 parent 369cf1b1 file · +8 −0Browse files

Unified · Split

gix-transport/tests/client/blocking_io/http/mod.rs+8−0
@@ -160,6 +160,7 @@ fn http_authentication_error_can_be_differentiated_and_identity_is_transmitted() · 159 unmodified lines
160160 .received_as_string()
161161 .lines()
162162 .map(str::to_lowercase)
163+ .filter(ignore_reqwest_content_length)
163164 .collect::<HashSet<_>>(),
164165 format!(
165166 "GET /path/not-important/info/refs?service=git-upload-pack HTTP/1.1
@@ -187,6 +188,7 @@ Authorization: Basic dXNlcjpwYXNzd29yZA== · 21 unmodified lines
187188 .lines()
188189 .map(str::to_lowercase)
189190 .filter(|l| !l.starts_with("expect: "))
191+ .filter(ignore_reqwest_content_length)
190192 .collect::<HashSet<_>>();
191193 // On linux on CI, for some reason, it won't have this chunk id here, but
192194 // it has it whenever and where-ever I run it.
@@ -337,6 +339,7 @@ fn handshake_v1() -> crate::Result { · 144 unmodified lines
337339 .received_as_string()
338340 .lines()
339341 .map(str::to_lowercase)
342+ .filter(ignore_reqwest_content_length)
340343 .collect::<HashSet<_>>(),
341344 format!(
342345 "GET /path/not/important/due/to/mock/info/refs?service=git-upload-pack HTTP/1.1
@@ -550,6 +553,7 @@ fn handshake_and_lsrefs_and_fetch_v2_impl(handshake_fixture: &str) -> crate::Res · 207 unmodified lines
550553 .received_as_string()
551554 .lines()
552555 .map(str::to_lowercase)
556+ .filter(ignore_reqwest_content_length)
553557 .collect::<HashSet<_>>(),
554558 format!(
555559 "GET /path/not/important/due/to/mock/info/refs?service=git-upload-pack HTTP/1.1
@@ -680,3 +684,7 @@ fn check_content_type_is_case_insensitive() -> crate::Result { · 124 unmodified lines
680684 assert!(result.is_ok());
681685 Ok(())
682686 }
687+
688+fn ignore_reqwest_content_length(header_line: &String) -> bool {
689+ header_line != "content-length: 0"
690+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t