Skip to content

Commit e604ad2

Browse files
committed
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: seanmonstar/reqwest#1971 For now, let's ignore Content-Length header lines.
1 parent 5c2a65a commit e604ad2

File tree

1 file changed

+8
-0
lines changed
  • gix-transport/tests/client/blocking_io/http

1 file changed

+8
-0
lines changed

gix-transport/tests/client/blocking_io/http/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ fn http_authentication_error_can_be_differentiated_and_identity_is_transmitted()
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==
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 {
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
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 {
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+
}

0 commit comments

Comments
 (0)