[web-devel] Getting the http request header in Yesod?
errantkid at gmail.com
Sun Sep 26 10:10:11 CEST 2010
On Sun, Sep 26, 2010 at 2:04 AM, Rehno Lindeque <errantkid at gmail.com> wrote:
> Thank you, that sounds exactly like what I need. I didn't notice it before!
> On Sat, Sep 25, 2010 at 6:57 PM, Michael Snoyman <michael at snoyman.com> wrote:
>> 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,
>>  http://hackage.haskell.org/packages/archive/yesod/0.5.0.3/doc/html/Yesod-Request.html#v:waiRequest
>>  http://hackage.haskell.org/packages/archive/wai/0.2.0/doc/html/Network-Wai.html#v:requestHeaders
>>  http://hackage.haskell.org/packages/archive/wai/0.2.0/doc/html/Network-Wai.html#t:CIByteString
Thanks a lot, this was very helpful!
One more question. Is it possible to manipulate the request header
when doing a redirect? For example, at one I have (redirect
RedirectTemporary $ AuthR LoginR), but "X-Requested-With" isn't being
More information about the web-devel