1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-19 18:47:03 +00:00

ui: Upgrade to elm/http 2.0.0

This commit is contained in:
James Hillyerd
2018-11-17 18:48:52 -08:00
parent e70900dd1a
commit f2cd3f92da
5 changed files with 36 additions and 33 deletions

View File

@@ -3,29 +3,29 @@ module HttpUtil exposing (delete, errorString, patch)
import Http
delete : String -> Http.Request ()
delete url =
delete : (Result Http.Error () -> msg) -> String -> Cmd msg
delete msg url =
Http.request
{ method = "DELETE"
, headers = []
, url = url
, body = Http.emptyBody
, expect = Http.expectStringResponse (\_ -> Ok ())
, expect = Http.expectWhatever msg
, timeout = Nothing
, withCredentials = False
, tracker = Nothing
}
patch : String -> Http.Body -> Http.Request ()
patch url body =
patch : (Result Http.Error () -> msg) -> String -> Http.Body -> Cmd msg
patch msg url body =
Http.request
{ method = "PATCH"
, headers = []
, url = url
, body = body
, expect = Http.expectStringResponse (\_ -> Ok ())
, expect = Http.expectWhatever msg
, timeout = Nothing
, withCredentials = False
, tracker = Nothing
}
@@ -42,11 +42,7 @@ errorString error =
"HTTP Network error"
Http.BadStatus res ->
"Bad HTTP status: " ++ String.fromInt res.status.code
"Bad HTTP status: " ++ String.fromInt res
Http.BadPayload msg res ->
"Bad HTTP payload: "
++ msg
++ " ("
++ String.fromInt res.status.code
++ ")"
Http.BadBody msg ->
"Bad HTTP body: " ++ msg