More unit testing.
Refactored HTTPRequest
Added MiddlewareErrorHandler.