refactored out http response process for use in more tests