From 416984d32fcb035d546fc7d4e28ea4dca91f36c1 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:48:10 -0700 Subject: [PATCH] fix: update integration test for enriched /json/version response The integration test at "server: get /json/version" was hardcoding the old response with Content-Length: 48. Updated to verify the enriched fields structurally since the version string varies at build time. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/Server.zig | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Server.zig b/src/Server.zig index 5f0883ad..68e3a53f 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -755,20 +755,16 @@ test "server: 404" { } test "server: get /json/version" { - const expected_response = - "HTTP/1.1 200 OK\r\n" ++ - "Content-Length: 48\r\n" ++ - "Connection: Close\r\n" ++ - "Content-Type: application/json; charset=UTF-8\r\n\r\n" ++ - "{\"webSocketDebuggerUrl\": \"ws://127.0.0.1:9222/\"}"; - { // twice on the same connection var c = try createTestClient(); defer c.deinit(); const res1 = try c.httpRequest("GET /json/version HTTP/1.1\r\n\r\n"); - try testing.expectEqual(expected_response, res1); + try testing.expect(std.mem.startsWith(u8, res1, "HTTP/1.1 200 OK\r\n")); + try testing.expect(std.mem.indexOf(u8, res1, "\"Browser\": \"Lightpanda/") != null); + try testing.expect(std.mem.indexOf(u8, res1, "\"Protocol-Version\": \"1.3\"") != null); + try testing.expect(std.mem.indexOf(u8, res1, "\"webSocketDebuggerUrl\": \"ws://127.0.0.1:9222/\"") != null); } { @@ -777,7 +773,8 @@ test "server: get /json/version" { defer c.deinit(); const res1 = try c.httpRequest("GET /json/version HTTP/1.1\r\n\r\n"); - try testing.expectEqual(expected_response, res1); + try testing.expect(std.mem.startsWith(u8, res1, "HTTP/1.1 200 OK\r\n")); + try testing.expect(std.mem.indexOf(u8, res1, "\"Browser\": \"Lightpanda/") != null); } }