From 7c86d4a8cc60aa501ae0eed31497356511333f57 Mon Sep 17 00:00:00 2001 From: Alex Biehl Date: Tue, 22 Feb 2022 10:37:06 +0100 Subject: [PATCH] Fix code generation for empty repsonse bodies --- src/Tie/Codegen/Response.hs | 2 +- test/golden/petstore.yaml.out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tie/Codegen/Response.hs b/src/Tie/Codegen/Response.hs index 710212e..117db53 100644 --- a/src/Tie/Codegen/Response.hs +++ b/src/Tie/Codegen/Response.hs @@ -71,7 +71,7 @@ codegenToResponses operationName responses defaultResponse = | Just {} <- jsonResponseContent = "(" <> "Data.Aeson.fromEncoding" <+> "(" <> "Data.Aeson.toEncoding" <+> "x" <> ")" <> ")" | otherwise = - mempty + "mempty" responseHeaders Response {jsonResponseContent} | Just {} <- jsonResponseContent = diff --git a/test/golden/petstore.yaml.out b/test/golden/petstore.yaml.out index 5d91400..3e96b1f 100644 --- a/test/golden/petstore.yaml.out +++ b/test/golden/petstore.yaml.out @@ -160,7 +160,7 @@ data CreatePetsResponse instance ToResponse CreatePetsResponse where toResponse (CreatePetsResponse201 ) = - Network.Wai.responseBuilder (toEnum 201) [] + Network.Wai.responseBuilder (toEnum 201) [] mempty toResponse (CreatePetsDefaultResponse status x) = Network.Wai.responseBuilder status [(Network.HTTP.Types.hContentType, "application/json")] (Data.Aeson.fromEncoding (Data.Aeson.toEncoding x)) ---------------------