Ensure that canonicalize_url strips any trailing unnecessary # or ?

AFMotion seems to be appending an extra `?` to requests without query strings
sometimes, which makes it really hard to figure out why a stub doesn't work.
This should help :)