mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-25 09:21:57 +03:00
Rename internal function.
This commit is contained in:
parent
6197b9a634
commit
ee345a8359
@ -310,8 +310,8 @@ optionalField fieldName decoder_ =
|
|||||||
|> Json.Decode.andThen finishDecoding
|
|> Json.Decode.andThen finishDecoding
|
||||||
|
|
||||||
|
|
||||||
fromResult : Result String value -> Json.Decode.Decoder value
|
jsonFromResult : Result String value -> Json.Decode.Decoder value
|
||||||
fromResult result =
|
jsonFromResult result =
|
||||||
case result of
|
case result of
|
||||||
Ok okValue ->
|
Ok okValue ->
|
||||||
Json.Decode.succeed okValue
|
Json.Decode.succeed okValue
|
||||||
@ -325,7 +325,7 @@ expectHeader : String -> Request String
|
|||||||
expectHeader headerName =
|
expectHeader headerName =
|
||||||
optionalField (headerName |> String.toLower) Json.Decode.string
|
optionalField (headerName |> String.toLower) Json.Decode.string
|
||||||
|> Json.Decode.field "headers"
|
|> Json.Decode.field "headers"
|
||||||
|> Json.Decode.andThen (\value -> fromResult (value |> Result.fromMaybe "Missing field headers"))
|
|> Json.Decode.andThen (\value -> jsonFromResult (value |> Result.fromMaybe "Missing field headers"))
|
||||||
|> noErrors
|
|> noErrors
|
||||||
|> Request
|
|> Request
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ expectFormPost toForm =
|
|||||||
in
|
in
|
||||||
Json.Decode.decodeValue innerDecoder parsedForm
|
Json.Decode.decodeValue innerDecoder parsedForm
|
||||||
|> Result.mapError Json.Decode.errorToString
|
|> Result.mapError Json.Decode.errorToString
|
||||||
|> fromResult
|
|> jsonFromResult
|
||||||
|> Request
|
|> Request
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -713,7 +713,7 @@ expectJsonBody jsonBodyDecoder =
|
|||||||
(\rawBody ->
|
(\rawBody ->
|
||||||
Json.Decode.decodeString jsonBodyDecoder rawBody
|
Json.Decode.decodeString jsonBodyDecoder rawBody
|
||||||
|> Result.mapError Json.Decode.errorToString
|
|> Result.mapError Json.Decode.errorToString
|
||||||
|> fromResult
|
|> jsonFromResult
|
||||||
)
|
)
|
||||||
|> noErrors
|
|> noErrors
|
||||||
, Json.Decode.succeed ( Err (ValidationError "Tried to parse JSON body but the request had no body."), [] )
|
, Json.Decode.succeed ( Err (ValidationError "Tried to parse JSON body but the request had no body."), [] )
|
||||||
|
Loading…
Reference in New Issue
Block a user