location_query is never null
This commit is contained in:
parent
a172a9a325
commit
ac6ddf829d
1 changed files with 3 additions and 4 deletions
|
|
@ -87,7 +87,7 @@ fn handleWeatherInternal(
|
|||
opts: *HandleWeatherOptions,
|
||||
req: *httpz.Request,
|
||||
res: *httpz.Response,
|
||||
location_query: ?[]const u8,
|
||||
location_query: []const u8,
|
||||
) !void {
|
||||
const allocator = req.arena;
|
||||
|
||||
|
|
@ -100,11 +100,10 @@ fn handleWeatherInternal(
|
|||
}
|
||||
|
||||
// Resolve location
|
||||
const loc_str = location_query orelse "";
|
||||
const location = if (loc_str.len == 0)
|
||||
const location = if (location_query.len == 0)
|
||||
Location{ .name = "London", .coords = .{ .latitude = 51.5074, .longitude = -0.1278 } }
|
||||
else
|
||||
opts.resolver.resolve(loc_str) catch |err| {
|
||||
opts.resolver.resolve(location_query) catch |err| {
|
||||
switch (err) {
|
||||
error.LocationNotFound => {
|
||||
res.status = 404;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue