Rename internal function.

This commit is contained in:
Dillon Kearns 2022-03-03 09:12:26 -08:00
parent 6197b9a634
commit ee345a8359

View File

@ -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."), [] )