Move request generation into function for reuse.