fix the location of ? for allowing trailing slashes
adding unit test for trailing slashes