mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-19 10:37:01 +00:00
ui: Initial Elm UI import
Merged from https://github.com/jhillyerd/inbucket-elm Uses https://github.com/halfzebra/create-elm-app
This commit is contained in:
39
ui/src/HttpUtil.elm
Normal file
39
ui/src/HttpUtil.elm
Normal file
@@ -0,0 +1,39 @@
|
||||
module HttpUtil exposing (..)
|
||||
|
||||
import Http
|
||||
|
||||
|
||||
delete : String -> Http.Request ()
|
||||
delete url =
|
||||
Http.request
|
||||
{ method = "DELETE"
|
||||
, headers = []
|
||||
, url = url
|
||||
, body = Http.emptyBody
|
||||
, expect = Http.expectStringResponse (\_ -> Ok ())
|
||||
, timeout = Nothing
|
||||
, withCredentials = False
|
||||
}
|
||||
|
||||
|
||||
errorString : Http.Error -> String
|
||||
errorString error =
|
||||
case error of
|
||||
Http.BadUrl str ->
|
||||
"Bad URL: " ++ str
|
||||
|
||||
Http.Timeout ->
|
||||
"HTTP timeout"
|
||||
|
||||
Http.NetworkError ->
|
||||
"HTTP Network error"
|
||||
|
||||
Http.BadStatus res ->
|
||||
"Bad HTTP status: " ++ toString res.status.code
|
||||
|
||||
Http.BadPayload msg res ->
|
||||
"Bad HTTP payload: "
|
||||
++ msg
|
||||
++ " ("
|
||||
++ toString res.status.code
|
||||
++ ")"
|
||||
Reference in New Issue
Block a user