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?
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