Simplified test code

This branch includes these changes:
- removed duplicate copies of the `verifyError` function
- use a single request helper function throughout