Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/tool-server/src/tools/network/network-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const zodSchema = z.object({
"Device id from list-devices (iOS simulator UDID or Android serial), the same id used with debugger-connect."
),
requestId: z.string().describe("The requestId from view-network-logs to get full details for"),
includeBody: z.coerce
includeBody: z
.boolean()
.default(true)
.describe("Whether to include the response body (if captured). Defaults to true."),
Expand Down
21 changes: 21 additions & 0 deletions packages/tool-server/test/chromium-network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,25 @@ describe("view-network-request-details (chromium branch)", () => {
});
expect(out).toMatch(/not found/);
});

it.each(["false", "0", "true"])("rejects a string includeBody %j", (value) => {
const result = networkRequestTool.zodSchema!.safeParse({
device_id: "chromium-cdp-9222",
requestId: "r1",
includeBody: value,
});

expect(result.error?.issues).toMatchObject([{ code: "invalid_type", path: ["includeBody"] }]);
});

it.each([true, false])("accepts a boolean includeBody %j", (value) => {
const result = networkRequestTool.zodSchema!.safeParse({
device_id: "chromium-cdp-9222",
requestId: "r1",
includeBody: value,
});

expect(result.success).toBe(true);
expect(result.data?.includeBody).toBe(value);
});
});
Loading