Fixes undefined var bug in Request

Also sets decent error reporting in unit tests