Skip to content

url: add join method

Rodrigo Muino Tomonari requested to merge github/fork/pdilyard/urljoin into master

Allows url paths to be combined with similar semantics to path.join.

Usage:

url.join('http://example.com', 'path', '/to', 'route');

The url module was missing a method to join several different parts of a path together into one normalized url string. Until now, the resolve method has been the closest thing, but only one path could be passed to append to the base url.

This functionality works by joining the keeping the source part of the url as-is, combining the rest of the arguments with posix.join, and then calling url.resolve with the source and combined path.

Merge request reports

Loading