Simplified test code

- removed duplicate copies of verifyError function
- use a single request helper function throughout