0

I have a Servant web application. I need to access the cookie headers for debugging purposes. From the browser, I can access the headers including the cookie headers. From the server, I use Wai's RequestLogger to log requests. The results do not show the cookie headers, however.

Is there a way to access the cookie headers in a Wai application?

unor
  • 92,415
  • 26
  • 211
  • 360
7puns
  • 1,505
  • 1
  • 9
  • 9
  • Take a look at this page: http://hackage.haskell.org/package/wai-3.2.2/docs/Network-Wai.html#t:Response –  Apr 17 '19 at 23:34
  • Thanks for your response. I am taking a look at the link. – 7puns Apr 18 '19 at 00:04

1 Answers1

0

I had to use a custom Wai Middleware to log the cookie headers in the requests. Wai Middleware is Application -> Application. The details are presented below in case someone finds it useful.

logRequestHeaders :: Application -> Application
logRequestHeaders incoming request outgoing = do
   let headerList = requestHeaders request
   liftIO $ mapM_ print headerList
   incoming request outgoing
7puns
  • 1,505
  • 1
  • 9
  • 9