add location header to ease debugging
This commit is contained in:
parent
62e7b83d1b
commit
8df2877644
1 changed files with 6 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue