From a977468a6a757ee182eeca23ef6fb53829937b49 Mon Sep 17 00:00:00 2001 From: Jeff Lewis Date: Wed, 16 Aug 2023 11:58:31 -0600 Subject: [PATCH] make head request test more permissive (#1157) --- .../tests/src/smithy4s/tests/PizzaSpec.scala | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/tests/src/smithy4s/tests/PizzaSpec.scala b/modules/tests/src/smithy4s/tests/PizzaSpec.scala index 37f32c106..2c35286ff 100644 --- a/modules/tests/src/smithy4s/tests/PizzaSpec.scala +++ b/modules/tests/src/smithy4s/tests/PizzaSpec.scala @@ -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" ) } }