Review fixes.

This commit is contained in:
Dillon Kearns 2023-01-06 18:24:34 -08:00
parent 223f2b69d5
commit 23aa988413
3 changed files with 7 additions and 12 deletions

View File

@ -5,7 +5,7 @@ module BackendTask.Http exposing
, withMetadata, Metadata
, Error(..)
, Body, emptyBody, stringBody, jsonBody
, CacheStrategy(..), requestWithOptions
, CacheStrategy(..), requestWithOptions, Options
)
{-| `BackendTask.Http` requests are an alternative to doing Elm HTTP requests the traditional way using the `elm/http` package.
@ -65,7 +65,7 @@ and describe your use case!
## Caching Options
@docs CacheStrategy, requestWithOptions
@docs CacheStrategy, requestWithOptions, Options
-}
@ -210,6 +210,7 @@ expectJson =
{-| -}
withMetadata : Expect value -> Expect ( Metadata, value )
withMetadata originalExpect =
-- known-unoptimized-recursion
case originalExpect of
ExpectJson jsonDecoder ->
ExpectMetadata (\metadata -> ExpectJson (jsonDecoder |> Json.Decode.map (Tuple.pair metadata)))
@ -227,7 +228,7 @@ withMetadata originalExpect =
ExpectMetadata (\metadata -> ExpectWhatever ( metadata, value ))
ExpectMetadata metadataToExpect ->
Debug.todo ""
ExpectMetadata (\metadata -> withMetadata (metadataToExpect metadata))
{-| -}
@ -244,6 +245,7 @@ expectWhatever =
expectToString : Expect a -> String
expectToString expect =
-- known-unoptimized-recursion
case expect of
ExpectJson _ ->
"ExpectJson"
@ -353,6 +355,7 @@ encodeOptions options =
)
{-| -}
type alias Options =
{ cacheStrategy : CacheStrategy
, retries : Int

View File

@ -134,14 +134,6 @@ app config =
}
batchDecoder : Decode.Decoder (List { request : Pages.StaticHttp.Request.Request, response : RequestsAndPending.Response })
batchDecoder =
Decode.map2 (\request response -> { request = request, response = response })
(Decode.field "request" requestDecoder)
(Decode.field "response" RequestsAndPending.decoder)
|> Decode.list
mergeResult : Result a a -> a
mergeResult r =
case r of

View File

@ -1,4 +1,4 @@
module RequestsAndPending exposing (RawResponse, RequestsAndPending, Response(..), ResponseBody(..), batchDecoder, bodyEncoder, decoder, get)
module RequestsAndPending exposing (RawResponse, RequestsAndPending, Response(..), ResponseBody(..), batchDecoder, bodyEncoder, get)
import Base64
import Bytes exposing (Bytes)