Rerouted (regenerated, verified). Same repository and tag, but GitHub now builds the zip with different bytes, so it no longer matches the SHA-1 package.elm-lang.org recorded. The Lamdera package server serves a copy recovered from https://github.com/jinjor/elm-req.
What we checked: Tag 1.0.0 is still on github.com/jinjor/elm-req; its commit df124f1a72a5 is from 2018-12-01 14:29 UTC, before the version was published (2018-12-01 14:34 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one (GitHub's zip no longer comes out byte for byte the same), so the contents were checked instead.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/jinjor/elm-req/zipball/1.0.0/
An experimental alternative for elm/http.
Warning: Not fully tested yet
put patch and delete.Cmd to Task gradually (and vice versa).Http.Error to custom error gradually.Create a task that works just like get.
getUserSimple : String -> Task Http.Error User
getUserSimple userName =
Req.get ("https://api.github.com/users/" ++ userName)
|> Req.stringTask (Req.simplyResolveJson userDecoder)Work with custom error that enables
Req / Http.Response String.type alias Error =
{ method : String
, url : String
, details : ErrorDetails
}
type ErrorDetails
= BadUrl String
| Timeout
| NetworkError
| BadStatus Int String (Dict String String) ErrorInfo
| BadBody String
| BadErrorBody String
| Bug String
type alias ErrorInfo =
{ message : String
}
getRepoWithDecodeError : String -> String -> Task Error Repo
getRepoWithDecodeError userName repoName =
Req.get ("https://api.github.com/repos/" ++ userName ++ "/" ++ repoName)
|> Req.stringTask (resolve buggyRepoDecoder)
resolve : Decoder a -> Req.Req -> Http.Response String -> Result Error a
resolve decoder req res =
case res of
Http.BadUrl_ url ->
err req (BadUrl url)
Http.Timeout_ ->
err req Timeout
Http.NetworkError_ ->
err req NetworkError
Http.BadStatus_ metadata body ->
case D.decodeString (errorDecoder metadata.statusCode) body of
Ok info ->
err req (BadStatus metadata.statusCode metadata.statusText metadata.headers info)
Err e ->
err req (BadErrorBody (D.errorToString e))
Http.GoodStatus_ _ body ->
case D.decodeString decoder body of
Ok a ->
Ok a
Err e ->
err req (BadBody (D.errorToString e))
err : Req.Req -> ErrorDetails -> Result Error a
err req details =
Err
{ method = req.method
, url = req.url
, details = details
}