简体   繁体   English

有没有办法访问Wai Web App的cookie头?

[英]Is there a way to access cookie headers for a Wai Web App?

I have a Servant web application. 我有一个Servant Web应用程序。 I need to access the cookie headers for debugging purposes. 我需要访问cookie头以进行调试。 From the browser, I can access the headers including the cookie headers. 在浏览器中,我可以访问包含cookie标头的标头。 From the server, I use Wai's RequestLogger to log requests. 从服务器,我使用Wai的RequestLogger来记录请求。 The results do not show the cookie headers, however. 但是,结果不会显示cookie标头。

Is there a way to access the cookie headers in a Wai application? 有没有办法访问Wai应用程序中的cookie头?

I had to use a custom Wai Middleware to log the cookie headers in the requests. 我不得不使用自定义Wai Middleware来记录请求中的cookie头。 Wai Middleware is Application -> Application . 围中间件是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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM