From 1e6c272599491356752c2dbda6ccc35964a20c9c Mon Sep 17 00:00:00 2001 From: monacoremo <59358383+monacoremo@users.noreply.github.com> Date: Sun, 31 Jan 2021 15:33:30 +0100 Subject: [PATCH] fix ctx RequestContext --- src/PostgREST/App.hs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/PostgREST/App.hs b/src/PostgREST/App.hs index 19bdd1b577..2a13e5e76d 100644 --- a/src/PostgREST/App.hs +++ b/src/PostgREST/App.hs @@ -172,8 +172,8 @@ handleRead headersOnly identifier context@RequestContext{..} = do bField <- binaryField context req let - ApiRequest{..} = rApiRequest - AppConfig{..} = rConfig + ApiRequest{..} = ctxApiRequest + AppConfig{..} = ctxConfig countQuery = QueryBuilder.readRequestToCountQuery req (tableTotal, queryTotal, _ , body, gucHeaders, gucStatus) <- @@ -186,14 +186,14 @@ handleRead headersOnly identifier context@RequestContext{..} = do else countQuery ) - (rContentType == Types.CTSingularJSON) + (ctxContentType == Types.CTSingularJSON) (shouldCount iPreferCount) - (rContentType == Types.CTTextCSV) + (ctxContentType == Types.CTTextCSV) bField - (Types.pgVersion rDbStructure) + (Types.pgVersion ctxDbStructure) configDbPreparedStatements - total <- readTotal rConfig rApiRequest tableTotal countQuery + total <- readTotal ctxConfig ctxApiRequest tableTotal countQuery response <- liftEither $ gucResponse <$> gucStatus <*> gucHeaders let @@ -208,7 +208,7 @@ handleRead headersOnly identifier context@RequestContext{..} = do ] ++ contentTypeHeaders context - failNotSingular rContentType queryTotal . response status headers $ + failNotSingular ctxContentType queryTotal . response status headers $ if headersOnly then mempty else toS body readTotal :: AppConfig -> ApiRequest -> Maybe Int64 -> SQL.Snippet -> DbHandler (Maybe Int64) @@ -454,8 +454,8 @@ writeQuery identifier@QualifiedIdentifier{..} isInsert pkCols context@RequestCon mutateReq <- liftEither $ - ReqBuilder.mutateRequest qiSchema qiName rApiRequest - (Types.tablePKCols rDbStructure qiSchema qiName) + ReqBuilder.mutateRequest qiSchema qiName ctxApiRequest + (Types.tablePKCols ctxDbStructure qiSchema qiName) readReq (_, queryTotal, fields, body, gucHeaders, gucStatus) <- @@ -463,13 +463,13 @@ writeQuery identifier@QualifiedIdentifier{..} isInsert pkCols context@RequestCon Statements.createWriteStatement (QueryBuilder.readRequestToQuery readReq) (QueryBuilder.mutateRequestToQuery mutateReq) - (rContentType == Types.CTSingularJSON) + (ctxContentType == Types.CTSingularJSON) isInsert - (rContentType == Types.CTTextCSV) - (iPreferRepresentation rApiRequest) + (ctxContentType == Types.CTTextCSV) + (iPreferRepresentation ctxApiRequest) pkCols - (Types.pgVersion rDbStructure) - (configDbPreparedStatements rConfig) + (Types.pgVersion ctxDbStructure) + (configDbPreparedStatements ctxConfig) liftEither $ CreateResult queryTotal fields body <$> gucStatus <*> gucHeaders