add location header to ease debugging

This commit is contained in:
Emil Lerch 2025-12-19 15:43:08 -08:00
parent 62e7b83d1b
commit 8df2877644
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -169,9 +169,13 @@ fn handleWeatherInternal(
}
} else try ansi.render(req_alloc, weather, .{ .use_imperial = use_imperial });
if (res.content_type != .JSON) {
// Add coordinates header using response allocator
const coords_header = try std.fmt.allocPrint(res.arena, "{d:.4},{d:.4}", .{ location.coords.latitude, location.coords.longitude });
res.headers.add("X-Location-Coordinates", coords_header);
if (res.content_type != .JSON)
res.content_type = .TEXT;
}
res.body = output;
}