diff options
Diffstat (limited to 'src/http/method.zig')
-rw-r--r-- | src/http/method.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/http/method.zig b/src/http/method.zig index 8c3e30c7f..91074d1b3 100644 --- a/src/http/method.zig +++ b/src/http/method.zig @@ -8,6 +8,7 @@ const MutableString = _global.MutableString; const stringZ = _global.stringZ; const default_allocator = _global.default_allocator; const C = _global.C; +const std = @import("std"); pub const Method = enum { GET, @@ -19,6 +20,17 @@ pub const Method = enum { CONNECT, TRACE, + const with_body: std.enums.EnumSet(Method) = brk: { + var values = std.enums.EnumSet(Method).initFull(); + values.remove(.HEAD); + values.remove(.TRACE); + break :brk values; + }; + + pub fn hasBody(this: Method) bool { + return with_body.contains(this); + } + pub fn which(str: []const u8) ?Method { if (str.len < 3) { return null; |