mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-19 13:31:43 +03:00
27 lines
803 B
Haskell
27 lines
803 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Hasura.HTTP.Utils where
|
|
|
|
import Control.Lens
|
|
import Hasura.Prelude
|
|
|
|
import qualified Data.Text.Encoding as T
|
|
import qualified Network.HTTP.Client as HTTP
|
|
import qualified Network.HTTP.Types as HTTP
|
|
import qualified Network.Wreq as Wreq
|
|
|
|
import Hasura.Server.Version (currentVersion)
|
|
|
|
|
|
wreqOptions :: HTTP.Manager -> [HTTP.Header] -> Wreq.Options
|
|
wreqOptions manager hdrs =
|
|
Wreq.defaults
|
|
& Wreq.headers .~ contentType : userAgent : hdrs
|
|
& Wreq.checkResponse ?~ (\_ _ -> return ())
|
|
& Wreq.manager .~ Right manager
|
|
where
|
|
contentType = ("Content-Type", "application/json")
|
|
userAgent = ( "User-Agent"
|
|
, "hasura-graphql-engine/" <> T.encodeUtf8 currentVersion
|
|
)
|