Skip to content

Commit 679246d

Browse files
authored
Merge pull request #83 from SentienceAPI/sdk_async2
proxy fix
2 parents a4c2b96 + d31a2ae commit 679246d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/browser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ export class SentienceBrowser {
5555
}
5656

5757
// Support proxy from parameter or environment variable
58-
this._proxy = proxy || process.env.SENTIENCE_PROXY;
58+
// Only use env var if it's a valid non-empty string
59+
const envProxy = process.env.SENTIENCE_PROXY;
60+
this._proxy = proxy || (envProxy && envProxy.trim() ? envProxy : undefined);
5961

6062
// Auth injection support
6163
this._userDataDir = userDataDir;
@@ -512,7 +514,7 @@ export class SentienceBrowser {
512514
* @returns Playwright proxy object or undefined if invalid
513515
*/
514516
private parseProxy(proxyString?: string): { server: string; username?: string; password?: string } | undefined {
515-
if (!proxyString) {
517+
if (!proxyString || !proxyString.trim()) {
516518
return undefined;
517519
}
518520

0 commit comments

Comments
 (0)