diff --git a/src/Pages/Internal/Platform/Cli.elm b/src/Pages/Internal/Platform/Cli.elm index ebde6d9f..7d13f4c1 100644 --- a/src/Pages/Internal/Platform/Cli.elm +++ b/src/Pages/Internal/Platform/Cli.elm @@ -586,7 +586,17 @@ sendStaticResponsesIfDone errors staticResponses manifest = (\( path, entry ) -> case entry of NotFetched (StaticHttpRequest.Request ( urls, _ )) rawResponses -> - if List.length urls == (rawResponses |> Dict.keys |> List.length) then + if + (urls + |> List.map Pages.Internal.Secrets.useFakeSecrets + |> Set.fromList + |> Set.size + ) + == (rawResponses + |> Dict.keys + |> List.length + ) + then False else diff --git a/tests/StaticHttpRequestsTests.elm b/tests/StaticHttpRequestsTests.elm index 15b0d8af..ff6bf978 100644 --- a/tests/StaticHttpRequestsTests.elm +++ b/tests/StaticHttpRequestsTests.elm @@ -119,6 +119,34 @@ all = } ] ) + , test "the port sends out when there are duplicate http requests for the same page" <| + \() -> + start + [ ( [] + , StaticHttp.map2 (\_ _ -> ()) + (StaticHttp.jsonRequest "http://example.com" (Decode.succeed ())) + (StaticHttp.jsonRequest "http://example.com" (Decode.succeed ())) + ) + ] + |> ProgramTest.simulateHttpOk + "GET" + "http://example.com" + """null""" + |> ProgramTest.expectOutgoingPortValues + "toJsPort" + (Codec.decoder Main.toJsCodec) + (Expect.equal + [ Main.Success + { pages = + Dict.fromList + [ ( "/" + , Dict.fromList [ ( "http://example.com", "null" ) ] + ) + ] + , manifest = manifest + } + ] + ) , test "an error is sent out for decoder failures" <| \() -> start