Added another test for raw_request failure scenario and fixed failing code