Improved request code, test for throwing exceptions.