99designs/ergo — pull request #2 by rbone (2012-01-08 11:06:35+00:00)
Title: Request & Response now support returning simplified versions of themselves

Added an `export` method to request and response which returns all their data as primitive values. The motivation for this is to provide a narrower interface for requests and responses to make testing against them easier.

Why is testing against the request/response interface difficult? Primarily the issue is with the number of objects they expose (HeaderCollection, HeaderField, Status, Url). Normally this wouldn't be a problem for tests against libraries which are dependant upon Ergo and thus include it as part of their codebase, they'd simply created standard requests and responses and get those objects for free.

For libraries which support Ergo but don't require it, the situation is somewhat different. Since Ergo isn't included directly, mocks/stubs must take the place of the request/response objects, as well as all of the other objects they expose. Unsurprisingly stubbing 5 objects just to get 1 gets old very fast. Providing a narrower interface to export the objects data would greatly simplify this.

Thoughts? :suspect: