Convenience functions for testing HTTP requests. Pull requests are welcome to add more useful functions.
These functions provide some convenient checks that can be used with ProgramTest.expectHttpRequest.
Assert that the given HTTP request has the specified header.
...
|> ProgramTest.expectHttpRequest "POST"
"https://example.com/ok"
(Test.Http.hasHeader "Content-Type" "application/json")These are ways to easily make Http.Response values for use with ProgramTest.simulateHttpResponse.
This is the same as Http.Timeout_,
but is exposed here so that your test doesn't need to import both Http and Test.Http.
This is the same as Http.NetworkError_,
but is exposed here so that your test doesn't need to import both Http and Test.Http.
This is a more convenient way to create Http.BadStatus_ and Http.GoodStatus_ values.
Following the logic in elm/http,
this will produce Http.GoodStatus_ if the given status code is in the 200 series, otherwise
it will produce Http.BadStatus_.
A convenient way to check something about the request body of a pending HTTP request.