From d371ce8b9d2409adb6ccf745d337347ce0e5d2a7 Mon Sep 17 00:00:00 2001 From: flopetautschnig <69145145+floscodes@users.noreply.github.com> Date: Mon, 24 Apr 2023 17:01:36 +0200 Subject: [PATCH] Update types.zig --- src/types.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/types.zig b/src/types.zig index 7d5c278..28ac93d 100644 --- a/src/types.zig +++ b/src/types.zig @@ -36,10 +36,12 @@ pub const Header = struct { pub const HTTP_Version = enum { HTTP1_1, HTTP2, - + + /// Parses from `[]u8` pub fn parse(s: []const u8) HTTP_Version { if (std.mem.containsAtLeast(u8, s, 1, "2")) return HTTP_Version.HTTP2 else return HTTP_Version.HTTP1_1; } + /// Stringifies `HTTP_Version` pub fn stringify(version: HTTP_Version) []const u8 { switch (version) { HTTP_Version.HTTP1_1 => return "HTTP/1.1",