generated from coulomb/repo-seed
fix(WP-0017/E3): Layer 3 error fixes — controllers and views
Fix compilation errors across 6 controllers and 29 views: import cleanup, ResponseException pattern for API auth, type fixes, unused import removal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import qualified Data.Text.Encoding as TE
|
||||
import qualified "cryptohash-sha256" Crypto.Hash.SHA256 as SHA256
|
||||
import qualified Data.ByteString.Base16 as Base16
|
||||
import Network.Wai (requestHeaders, responseLBS)
|
||||
import IHP.Controller.Response (ResponseException (..))
|
||||
|
||||
-- | Extract Bearer token from Authorization header and validate it
|
||||
-- against the api_keys table. Returns the ApiConsumer on success,
|
||||
@@ -52,12 +53,10 @@ unauthorized401 = respondWithStatus 401 $ object
|
||||
]
|
||||
|
||||
respondWithStatus :: (?respond :: Respond) => Int -> Value -> IO a
|
||||
respondWithStatus status body = do
|
||||
respondAndExit $ responseLBS
|
||||
(toEnum status)
|
||||
[("Content-Type", "application/json")]
|
||||
(encode body)
|
||||
error "respondAndExit: unreachable"
|
||||
respondWithStatus status body = throwIO $ ResponseException $ responseLBS
|
||||
(toEnum status)
|
||||
[("Content-Type", "application/json")]
|
||||
(encode body)
|
||||
|
||||
-- | SHA-256 hex hash of the key (same as stored in key_hash column)
|
||||
hashApiKey :: Text -> Text
|
||||
|
||||
Reference in New Issue
Block a user