Skip to content

Commit

Permalink
Fix problem where Chrome converts all names of HTTP response headers …
Browse files Browse the repository at this point in the history
…to lower-case

See elm/http#31
  • Loading branch information
c-mart committed May 31, 2019
1 parent 6b49d37 commit 076356c
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/Rest/Rest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1375,10 +1375,27 @@ decodeAuthToken response =
case Decode.decodeString decodeAuthTokenDetails body of
Ok tokenDetailsWithoutTokenString ->
let
authTokenString =
Maybe.withDefault "" (Dict.get "X-Subject-Token" metadata.headers)
authTokenFromHeader : Result String String
authTokenFromHeader =
case Dict.get "X-Subject-Token" metadata.headers of
Just token ->
Ok token

Nothing ->
-- https://github.com/elm/http/issues/31
case Dict.get "x-subject-token" metadata.headers of
Just token2 ->
Ok token2

Nothing ->
Err "Could not find an auth token in response headers"
in
Ok (tokenDetailsWithoutTokenString authTokenString)
case authTokenFromHeader of
Ok authTokenString ->
Ok (tokenDetailsWithoutTokenString authTokenString)

Err errStr ->
Err errStr

Err error ->
Err (Debug.toString error)
Expand Down

0 comments on commit 076356c

Please sign in to comment.