Skip to content
Snippets Groups Projects
WAI.hs 519 B
Newer Older
  • Learn to ignore specific revisions
  • {-# LANGUAGE OverloadedStrings #-}
    
    module Util.WAI
      ( postJSON
      ) where
    
    import Data.ByteString.Lazy as LazyBS
    import Data.ByteString as BS
    import Test.Hspec.Wai
      ( WaiSession
      , request
      )
    import Network.HTTP.Types.Method
      ( methodPost
      )
    import Network.Wai.Test
      ( SResponse
      )
    
    -- Post some JSON to a path.
    -- Return a function from path to a response
    postJSON :: BS.ByteString -> (LazyBS.ByteString -> WaiSession SResponse)
    postJSON path =
      request methodPost path [("Content-Type", "application/json")]