Fixed the return with an empty array instead of undef
Take the request url directly from the request object