Split generating the request URL into a...

...separate function.