mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 09:51:59 +03:00
25 lines
566 B
Haskell
25 lines
566 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Hasura.Server.Utils where
|
|
|
|
import qualified Data.Text as T
|
|
import Hasura.Prelude
|
|
|
|
dropAndSnakeCase :: T.Text -> T.Text
|
|
dropAndSnakeCase = T.drop 9 . toSnakeCase . T.toLower
|
|
|
|
toSnakeCase :: T.Text -> T.Text
|
|
toSnakeCase = T.pack . map change . T.unpack
|
|
where
|
|
change '-' = '_'
|
|
change c = c
|
|
|
|
isXHasuraTxt :: T.Text -> Bool
|
|
isXHasuraTxt = T.isInfixOf "x-hasura-" . T.toLower
|
|
|
|
userRoleHeader :: T.Text
|
|
userRoleHeader = "x-hasura-role"
|
|
|
|
accessKeyHeader :: T.Text
|
|
accessKeyHeader = "x-hasura-access-key"
|