commit ef30005ec7adf0836f62715267b50be8632fb877 from: Omar Polo date: Thu Dec 21 11:30:39 2023 UTC http: add the other methods commit - bcc284ab8e7abda0c6386b1c18cdabe5a4f994b6 commit + ef30005ec7adf0836f62715267b50be8632fb877 blob - 955d9c88feb750d6cd155a398ebf19ff8a229ed2 blob + 60fa73fe95beff5dfd776fde9d75e9d8e74241a3 --- http/http.ha +++ http/http.ha @@ -42,7 +42,14 @@ export type version = enum { export type method = enum { GET, + HEAD, POST, + PUT, + DELETE, + CONNECT, + OPTIONS, + TRACE, + PATCH, }; export type request = struct { @@ -122,14 +129,21 @@ fn parse_req(c: *client) (bool | error | encoding::utf case let line: const str => yield line; }; - // first line if (c.first_line) { c.first_line = false; let (method, rest) = strings::cut(line, " "); switch (method) { - case "GET" => c.request.method = method::GET; + case "GET" => c.request.method = method::GET; + case "HEAD" => c.request.method = method::HEAD; + case "POST" => c.request.method = method::POST; + case "PUT" => c.request.method = method::PUT; + case "DELETE" => c.request.method = method::DELETE; + case "CONNECT" => c.request.method = method::CONNECT; + case "OPTIONS" => c.request.method = method::OPTIONS; + case "TRACE" => c.request.method = method::TRACE; + case "PATCH" => c.request.method = method::PATCH; case => return badrequest; };