Skip to content

Commit

Permalink
fix: remove trailing proxy uri slash (#75)
Browse files Browse the repository at this point in the history
Co-authored-by: AndreyBykov <[email protected]>
  • Loading branch information
szmarczak and AndreyBykov authored May 31, 2022
1 parent f4e8407 commit 5eda669
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/launch-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,17 @@ export class LaunchContext<
* Use `undefined` to unset existing proxy URL.
*/
set proxyUrl(url: string | undefined) {
this._proxyUrl = url && new URL(url).href;
if (!url) {
return;
}

const urlInstance = new URL(url);
urlInstance.pathname = '/';
urlInstance.search = '';
urlInstance.hash = '';

// https://www.chromium.org/developers/design-documents/network-settings/#command-line-options-for-proxy-settings
this._proxyUrl = urlInstance.href.slice(0, -1);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/browser-plugins/plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const runPluginTest = <
id,
launchOptions,
browserPlugin: plugin,
_proxyUrl: proxyUrl,
_proxyUrl: proxyUrl.slice(0, -1),
one: 1,
useIncognitoPages: false,
};
Expand Down

0 comments on commit 5eda669

Please sign in to comment.