7digital/SevenDigital.Api.Wrapper — pull request #158 by gregsochanik (2014-04-28 10:22:41+00:00)
Title: This adds the `OriginalRequest` to the `ApiException` object, 

when using the default `HttpClientMediator`.

More importantly, this allows the exact data of the original request to be pulled from an `ApiException` to help with error logging from within a consuming client, which is not something that AFAIK has been available up to now.

I've only been able to find details of the original `EndpointUrl`, which does not contain any headers, querystring or request payload. (happy to be corrected on this!)

I have left the `OriginalRequest` as a mutable property within `Response`, as it allowed me to change as little of the code as possible, with an eye to the pending async work.

NOTE:
I've noticed that `Response` translates a `WebException` into an `ApiWebException`, but delving in to `HttpClientMediator` shows that this is caught in `TryGetResponse` and only re-thrown if the WebException Response is empty.

I have added a 2nd commit to pull the originalRequest up to the base ApiResponse so the request exception can be viewed there, but this causes a little confusion with the `ApiException.Uri` property. As this ctor is public I have left it in, but would be good to remove this at some point as is quite confusing.