Factor out common request and response methods.