The naive root + path might cause cases of double slashes e.g. http://path//relative-path.
This indeed happened with the out of the box google cloud endpoints GA discovery documents.
Switch to url.resolve to solve this cases.