Fixed issue where REQUEST_URI is not defined

e.g. in tests