I didn't write a test since there don't seem to be any similar tests yet,
and I'm not familiar enough with the test infrastructure.
Include request URL in error message.
LGTM. I couldn't find an easy way to test this. See also #791.