diff --git a/src/http/Server.zig b/src/http/Server.zig index 5ea0c49..d8b611d 100644 --- a/src/http/Server.zig +++ b/src/http/Server.zig @@ -242,14 +242,25 @@ test "handleWeather: default endpoint uses IP address" { try ht.expectStatus(200); try ht.expectBody( - \\
Weather report: Union City, California, United States
+        \\
+        \\
+        \\
+        \\
+        \\
+        \\
+        \\
+        \\
+        \\Weather report: Union City, California, United States
         \\
         \\    \   /         Clear
         \\     .-.          +68(+68) °F
         \\  ― (   ) ―  3 mph
         \\     `-'          6 mi
         \\    /   \         0.0 in
-        \\
+ \\
); } diff --git a/src/render/Formatted.zig b/src/render/Formatted.zig index 6fc9132..3ef0182 100644 --- a/src/render/Formatted.zig +++ b/src/render/Formatted.zig @@ -100,9 +100,26 @@ pub const RenderOptions = struct { format: Format = .ansi, }; +fn writeHtmlHeader(w: *std.Io.Writer) !void { + try w.writeAll( + \\ + \\ + \\ + \\ + \\ + \\ + \\ + \\
+        \\
+    );
+}
+
 pub fn render(writer: *std.Io.Writer, data: types.WeatherData, options: RenderOptions) !void {
     const w = writer;
-    if (options.format == .html) try w.writeAll("
");
+    if (options.format == .html) try writeHtmlHeader(w);
     if (!options.super_quiet)
         try w.print(
             "{s}{s}\n\n",
@@ -118,7 +135,7 @@ pub fn render(writer: *std.Io.Writer, data: types.WeatherData, options: RenderOp
             try renderForecastDay(w, day, options);
         }
     }
-    if (options.format == .html) try w.writeAll("
"); + if (options.format == .html) try w.writeAll("
"); } fn renderCurrent(w: *std.Io.Writer, current: types.CurrentCondition, options: RenderOptions) !void {