refactor out common method for stubbing JSON requests