yesodweb/yesod — pull request #495 by paul-rouse (2013-01-29 20:39:47+00:00)
Title: Provide mechanism to add extra headers to a request in Yesod.Test

This is a small change I'd like to offer to allow additional HTTP headers to be set in requests made by Yesod.Test.

By way of motivation, my use case - a fairly obvious one, I think - is testing the ajax parts of an app, where I need a header (X-Requested-With in my case) to alter error reporting and login handling.

The existing *doRequest* function in Yesod.Test is actually documented in a way which suggests it might have provided this, but obviously it didn't happen that way. I have preserved the signature of *doRequest* while moving the bulk of the code into a new function *doRequestHeaders*, which has an extra parameter to specify the headers.

I hope this meets with your approval!