mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-24 20:31:42 +03:00
Make sure that duplicate requests don't cause the CLI to hang.
This commit is contained in:
parent
8bc59a3d59
commit
f44be0d46c
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user