Fix code generation for empty repsonse bodies

This commit is contained in:
Alex Biehl 2022-02-22 10:37:06 +01:00
parent d13775ac83
commit 7c86d4a8cc
2 changed files with 2 additions and 2 deletions

View File

@ -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 =

View File

@ -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))
---------------------