server: reintroduce Content-Type header for errors

Fix regression introduced by hasura/graphql-engine-mono#7444.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7827
GitOrigin-RevId: 468f2a53f44b732c09f09ca71a3a2c4b38e4e360
This commit is contained in:
Auke Booij 2023-02-07 12:26:06 +01:00 committed by hasura-bot
parent 5f9e70a527
commit 36a9de5215

View File

@ -400,8 +400,9 @@ mkSpockAction serverCtx@ServerCtx {..} qErrEncoder qErrModifier apiHandler = do
let httpLogMetadata = buildHttpLogMetadata @m3 emptyHttpLogGraphQLInfo extraUserInfo
jsonResponse = J.encode $ qErrEncoder includeInternal qErr
contentLength = ("Content-Length", B8.toStrict $ BB.toLazyByteString $ BB.int64Dec $ BL.length jsonResponse)
allHeaders = [contentLength, jsonHeader]
lift $ logHttpError (_lsLogger scLoggers) scLoggingSettings userInfo reqId waiReq req qErr headers httpLogMetadata
setHeader contentLength
mapM_ setHeader allHeaders
Spock.setStatus $ qeStatus qErr
Spock.lazyBytes jsonResponse