Skip to content

Commit 3ad7936

Browse files
committed
browser context proxyServer
1 parent 9b35736 commit 3ad7936

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/cdp/domains/target.zig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ fn getBrowserContexts(cmd: anytype) !void {
6666
}
6767

6868
fn createBrowserContext(cmd: anytype) !void {
69+
if (try cmd.params(struct {
70+
disposeOnDetach: bool = false,
71+
proxyServer: ?[]const u8 = null,
72+
proxyBypassList: ?[]const u8 = null,
73+
originsWithUniversalNetworkAccess: ?[]const []const u8 = null,
74+
})) |params| {
75+
if (params.disposeOnDetach or params.proxyBypassList != null or params.originsWithUniversalNetworkAccess != null) return error.NotYetImplementedParams;
76+
77+
if (params.proxyServer) |proxy| {
78+
// For now the http client is not in the browser context so we assume there is just 1.
79+
const proxy_cp = try cmd.cdp.browser.http_client.allocator.dupe(u8, proxy);
80+
cmd.cdp.browser.http_client.http_proxy = try std.Uri.parse(proxy_cp);
81+
}
82+
}
83+
6984
const bc = cmd.createBrowserContext() catch |err| switch (err) {
7085
error.AlreadyExists => return cmd.sendError(-32000, "Cannot have more than one browser context at a time"),
7186
else => return err,

0 commit comments

Comments
 (0)