Update types.zig
This commit is contained in:
parent
104f2c7649
commit
d371ce8b9d
1 changed files with 3 additions and 1 deletions
|
@ -37,9 +37,11 @@ pub const HTTP_Version = enum {
|
||||||
HTTP1_1,
|
HTTP1_1,
|
||||||
HTTP2,
|
HTTP2,
|
||||||
|
|
||||||
|
/// Parses from `[]u8`
|
||||||
pub fn parse(s: []const u8) HTTP_Version {
|
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;
|
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 {
|
pub fn stringify(version: HTTP_Version) []const u8 {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
HTTP_Version.HTTP1_1 => return "HTTP/1.1",
|
HTTP_Version.HTTP1_1 => return "HTTP/1.1",
|
||||||
|
|
Loading…
Reference in a new issue