fix: Return 204 No Content without Content-Type for RPCs returning VOID

Resolves #2001

BREAKING CHANGE: Previously, those RPCs would return "null" as a body with Content-Type: application/json.
This commit is contained in:
Wolfgang Walther
2022-02-05 09:28:28 +01:00
committed by Wolfgang Walther
parent 9ca9a54d21
commit 52d628f1ed
7 changed files with 66 additions and 33 deletions
+6 -3
View File
@@ -469,9 +469,12 @@ handleInvoke invMethod proc context@RequestContext{..} = do
RangeQuery.rangeStatusHeader iTopLevelRange queryTotal tableTotal
failNotSingular iAcceptContentType queryTotal $
response status
(contentTypeHeaders context ++ [contentRange])
(if invMethod == InvHead then mempty else LBS.fromStrict body)
if Proc.procReturnsVoid proc then
response HTTP.status204 [contentRange] mempty
else
response status
(contentTypeHeaders context ++ [contentRange])
(if invMethod == InvHead then mempty else LBS.fromStrict body)
handleOpenApi :: Bool -> Schema -> RequestContext -> DbHandler Wai.Response
handleOpenApi headersOnly tSchema (RequestContext conf@AppConfig{..} dbStructure apiRequest ctxPgVersion) = do