Last active
April 5, 2019 03:45
-
-
Save jzxhuang/5fdf8b2f6eb37a52657647bfbe3101bb to your computer and use it in GitHub Desktop.
Convert a string Http.Response to a Tuple (Http.Metadata, String)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convertResponseString : Response String -> Result Error ( Metadata, String ) | |
convertResponseString httpResponse = | |
case httpResponse of | |
Http.BadUrl_ url -> | |
Err (Http.BadUrl url) | |
Http.Timeout_ -> | |
Err Http.Timeout | |
Http.NetworkError_ -> | |
Err Http.NetworkError | |
Http.BadStatus_ metadata body -> | |
Err (Http.BadStatus metadata.statusCode) | |
Http.GoodStatus_ metadata body -> | |
Ok ( metadata, body ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment