From 98ada3f9ee4751b60157f206a0f315ce3e895261 Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Sun, 27 Nov 2016 23:55:07 -0500 Subject: [PATCH] Change nesting of if clause making code more symetrical --- src/PostgREST/ApiRequest.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/PostgREST/ApiRequest.hs b/src/PostgREST/ApiRequest.hs index 4f1c5d657..877774bf6 100644 --- a/src/PostgREST/ApiRequest.hs +++ b/src/PostgREST/ApiRequest.hs @@ -162,15 +162,13 @@ userApiRequest schema req reqBody ct -> Left $ toS $ "Content-Type not acceptable: " <> toMime ct topLevelRange = fromMaybe allRange $ M.lookup "limit" ranges - action = - if isTargetingProc - then ActionInvoke - else - case method of + action = case method of "GET" -> if target == TargetRoot then ActionInspect else ActionRead - "POST" -> ActionCreate + "POST" -> if isTargetingProc + then ActionInvoke + else ActionCreate "PATCH" -> ActionUpdate "DELETE" -> ActionDelete "OPTIONS" -> ActionInfo