Skip to content

Lightpanda: the headless browser designed for AI and automation

parseMethod for HEAD requests in XHR

Muki Kiboigo8bbe1907b067
diff --git a/src/browser/webapi/net/XMLHttpRequest.zig b/src/browser/webapi/net/XMLHttpRequest.zig
index 3889c2771..35bf4fb09 100644
--- a/src/browser/webapi/net/XMLHttpRequest.zig
+++ b/src/browser/webapi/net/XMLHttpRequest.zig
@@ -793,21 +793,14 @@ fn stateChanged(self: *XMLHttpRequest, state: ReadyState, exec: *const Execution
}
fn parseMethod(method: []const u8) !http.Method {
- if (std.ascii.eqlIgnoreCase(method, "get")) {
- return .GET;
- }
- if (std.ascii.eqlIgnoreCase(method, "post")) {
- return .POST;
- }
- if (std.ascii.eqlIgnoreCase(method, "delete")) {
- return .DELETE;
- }
- if (std.ascii.eqlIgnoreCase(method, "put")) {
- return .PUT;
- }
- if (std.ascii.eqlIgnoreCase(method, "propfind")) {
- return .PROPFIND;
- }
+ if (std.ascii.eqlIgnoreCase(method, "get")) return .GET;
+ if (std.ascii.eqlIgnoreCase(method, "put")) return .PUT;
+ if (std.ascii.eqlIgnoreCase(method, "post")) return .POST;
+ if (std.ascii.eqlIgnoreCase(method, "delete")) return .DELETE;
+ if (std.ascii.eqlIgnoreCase(method, "head")) return .HEAD;
+ if (std.ascii.eqlIgnoreCase(method, "options")) return .OPTIONS;
+ if (std.ascii.eqlIgnoreCase(method, "patch")) return .PATCH;
+ if (std.ascii.eqlIgnoreCase(method, "propfind")) return .PROPFIND;
return error.InvalidMethod;
}