Update types.zig

This commit is contained in:
flopetautschnig 2023-04-24 17:01:36 +02:00 committed by GitHub
parent 104f2c7649
commit d371ce8b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,9 +37,11 @@ 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",