diff --git a/modules/openapi-generator/src/main/resources/elm/Api.mustache b/modules/openapi-generator/src/main/resources/elm/Api.mustache index 2890e9deac9..57b78a2620c 100644 --- a/modules/openapi-generator/src/main/resources/elm/Api.mustache +++ b/modules/openapi-generator/src/main/resources/elm/Api.mustache @@ -3,6 +3,7 @@ module Api exposing , request , send , sendWithCustomError + , sendWithCustomExpect , task , map , withBasePath @@ -55,13 +56,18 @@ send toMsg req = sendWithCustomError : (Http.Error -> e) -> (Result e a -> msg) -> Request a -> Cmd msg -sendWithCustomError mapError toMsg (Request req) = +sendWithCustomError mapError toMsg req = + sendWithCustomExpect (expectJson mapError toMsg) req + + +sendWithCustomExpect : (Json.Decode.Decoder a -> Http.Expect msg) -> Request a -> Cmd msg +sendWithCustomExpect expect (Request req) = Http.request { method = req.method , headers = req.headers , url = Url.Builder.crossOrigin req.basePath req.pathParams req.queryParams , body = req.body - , expect = expectJson mapError toMsg req.decoder + , expect = expect req.decoder , timeout = req.timeout , tracker = req.tracker } diff --git a/samples/openapi3/client/elm/src/Api.elm b/samples/openapi3/client/elm/src/Api.elm index 842a33ca3aa..9d6f5de1e7e 100644 --- a/samples/openapi3/client/elm/src/Api.elm +++ b/samples/openapi3/client/elm/src/Api.elm @@ -3,6 +3,7 @@ module Api exposing , request , send , sendWithCustomError + , sendWithCustomExpect , task , map , withBasePath @@ -55,13 +56,18 @@ send toMsg req = sendWithCustomError : (Http.Error -> e) -> (Result e a -> msg) -> Request a -> Cmd msg -sendWithCustomError mapError toMsg (Request req) = +sendWithCustomError mapError toMsg req = + sendWithCustomExpect (expectJson mapError toMsg) req + + +sendWithCustomExpect : (Json.Decode.Decoder a -> Http.Expect msg) -> Request a -> Cmd msg +sendWithCustomExpect expect (Request req) = Http.request { method = req.method , headers = req.headers , url = Url.Builder.crossOrigin req.basePath req.pathParams req.queryParams , body = req.body - , expect = expectJson mapError toMsg req.decoder + , expect = expect req.decoder , timeout = req.timeout , tracker = req.tracker }