Skip to content

Commit

Permalink
make head request test more permissive (#1157)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisjkl committed Aug 16, 2023
1 parent 39fb372 commit a977468
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions modules/tests/src/smithy4s/tests/PizzaSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,20 @@ abstract class PizzaSpec
)
} yield {
val (code, headers, body) = res
// There may be other headers, but this one should definitely exist.
// In general, content-length and content-type headers should be omitted
// but we won't fail the test if they aren't since the HTTP Spec is
// fairly vague and thus permissive in this area.
val expectedHeaders = Map(
"Test" -> List("test")
)
val containsAllExpectedHeaders =
expectedHeaders.forall(h => headers.get(h._1).contains(h._2))
expect.same(code, 200) &&
expect.same(body, "") &&
expect.same(
headers,
HeaderMap(
Map(
CaseInsensitive("Test") -> List("test")
)
)
expect(
containsAllExpectedHeaders,
s"Expected to find all of $expectedHeaders inside of $headers"
)
}
}
Expand Down

0 comments on commit a977468

Please sign in to comment.