snoyberg/http-client — pull request #79 by DanielG (2014-10-08 22:19:16+00:00)
Title: Add redirect loop that keeps track of intermediary requests and responses

Hey,

I haven't tested this properly yet, just submitting it to get some feedback.

I added a function (`httpRedirect'`) that is basically the same as the old `httpRedirect` but returns a list of (Request, Response) pairs which have been performed instead of discarding the path taken through the redirect jungle.

I need this to get the URL of the last redirect, since the old function only returned the final response there was no easy way to get at the URL we ended up at.

To give the user maximum flexibility I had to change the type of the `http'` function passed to `httpRedirect'`. The new type is now: `Request -> IO (Either (Response b, Request) (Response c))` this is so the user can strictly retrieve part or whole of the intermediary requests while still allowing them to stream the final response or whatever else the types allow.

Also `httpRedirect` is now implemented in terms of `httpRedirect'` and (hopefully) maintains full backwards compatibility.

I didn't actually export `httpRedirect'` I leave that to the maintainer if this patch is accepted :)