[web-devel] Getting the http request header in Yesod?
michael at snoyman.com
Sat Sep 25 18:57:40 CEST 2010
On Sat, Sep 25, 2010 at 10:32 AM, Rehno Lindeque <errantkid at gmail.com> wrote:
> I'm looking to detect ajax requests sent to my yesod application using
> the technique detailed in http://davidwalsh.name/detect-ajax
> Is it possible to gain access to the request header directly or would
> yesod require modification to get at it? If someone could just point
> me in the right direction, I would be grateful. I imagine it would be
> a function returning GHandler?
You can use waiRequest to get access to the WAI request value, and
requestHeaders to get the request headers from it. It's very
convenient to use the OverloadedStrings extensions when dealing with
the CIByteString datatype.
Hope that helps,
More information about the web-devel