extra-request 4.1.0 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3907,18 +3907,15 @@
3907
3907
  function appendPathname(pathname) {
3908
3908
  return (options) => {
3909
3909
  const base = es2018$c.go(() => {
3910
- const directoryPathname = es2018$c.go(() => {
3911
- let pathname = options.url.pathname;
3912
- if (!options.url.pathname.endsWith('/')) {
3913
- pathname += '/';
3914
- }
3915
- return pathname;
3916
- });
3917
3910
  const url = new URL(options.url.href);
3918
- url.pathname = directoryPathname;
3911
+ url.pathname = url.pathname.endsWith('/')
3912
+ ? url.pathname
3913
+ : `${url.pathname}/`;
3919
3914
  return url;
3920
3915
  });
3921
- const url = new URL(pathname, base);
3916
+ const url = new URL(pathname.replace(/^\/*/, ''), base);
3917
+ url.search = base.search;
3918
+ url.hash = base.hash;
3922
3919
  return Object.assign(Object.assign({}, options), { url });
3923
3920
  };
3924
3921
  }