diff --git a/src/net/http.zig b/src/net/http.zig index 4e49fed..7e5f58e 100644 --- a/src/net/http.zig +++ b/src/net/http.zig @@ -1,4 +1,5 @@ const std = @import("std"); +const builtin = @import("builtin"); const log = std.log.scoped(.http); @@ -406,10 +407,17 @@ pub const Client = struct { // those to debug so the warn-level log stream // stays focused on cases the operator can act on // (auth, rate, server outages). - if (response.status == .not_found) { - log.debug("http rejection body status=404 body={s}", .{response.body}); - } else { - log.warn("http rejection body status={d} body={s}", .{ @intFromEnum(response.status), response.body }); + // + // Skipped entirely under `zig build test`: the + // error-classification tests intentionally drive + // non-2xx statuses through here, and their warn + // output would otherwise pollute the test stream. + if (!builtin.is_test) { + if (response.status == .not_found) { + log.debug("http rejection body status=404 body={s}", .{response.body}); + } else { + log.warn("http rejection body status={d} body={s}", .{ @intFromEnum(response.status), response.body }); + } } response.allocator.free(response.body); if (response.etag) |e| response.allocator.free(e);