servant-combinators-0.0.2: Extra servant combinators for full WAI functionality.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Servant.API.RawQueryString

Description

 
Synopsis

Documentation

data RawQueryString Source #

RawQueryString gives handler authors a combinator to access the raw (that is, un-parsed) query string from the WAI request, as a ByteString.

Generally speaking, you should prefer to use the QueryString combinator, but if you need access to the raw value, this combinator provides it.

Example:

import Control.Monad.IO.Class (liftIO)
import Servant
import ServantExtras.RawQueryString

import qualified Network.HTTP.Types.Header as NTH (Header)

type MyAPI = "my-query-endpoint"
           :> RawQueryString
           :> Get '[JSON] NoContent

myServer :: Server MyAPI
myServer = queryEndpointHandler
  where
    queryEndpointHandler :: ByteString -> Handler NoContent
    queryEndpointHandler queryStr =
      -- do something with the ByteString, like pass it to a
      -- sub-process

Instances

Instances details
HasServer api ctx => HasServer (RawQueryString :> api :: Type) ctx Source # 
Instance details

Defined in Servant.API.RawQueryString

Associated Types

type ServerT (RawQueryString :> api) m #

Methods

route :: Proxy (RawQueryString :> api) -> Context ctx -> Delayed env (Server (RawQueryString :> api)) -> Router env #

hoistServerWithContext :: Proxy (RawQueryString :> api) -> Proxy ctx -> (forall x. m x -> n x) -> ServerT (RawQueryString :> api) m -> ServerT (RawQueryString :> api) n #

type ServerT (RawQueryString :> api :: Type) m Source # 
Instance details

Defined in Servant.API.RawQueryString

type ServerT (RawQueryString :> api :: Type) m = ByteString -> ServerT api m