Skip to content

Commit

Permalink
Add test for #163 (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi authored Jul 22, 2024
1 parent fa71753 commit 927132b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions requests/test/src/requests/RequestTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,13 @@ object RequestTests extends TestSuite{
}
}
}

// Ensure when duplicate headers are passed to requests, we only pass the last one
// to the server. This preserves the 0.8.x behavior, and can always be overriden
// by passing a comma-separated list of headers instead
test("duplicateHeaders"){
val res = requests.get("https://httpbin.org/get", headers = Seq("x-y" -> "a", "x-y" -> "b"))
assert(ujson.read(res)("headers")("X-Y") == Str("b")) // make sure it's not "a,b"
}
}
}

0 comments on commit 927132b

Please sign in to comment.