http.requestHasBody: a PUT response can have a body

HEAD/TRACE are bodyless, but PUT responses are body-capable
per RFC 7231.
This commit is contained in:
Frank Denis 2025-11-26 23:04:41 +01:00 committed by Andrew Kelley
parent a1827d5977
commit 854774d468

View file

@ -44,8 +44,8 @@ pub const Method = enum {
/// Actual behavior from clients may vary and should still be checked /// Actual behavior from clients may vary and should still be checked
pub fn responseHasBody(m: Method) bool { pub fn responseHasBody(m: Method) bool {
return switch (m) { return switch (m) {
.GET, .POST, .DELETE, .CONNECT, .OPTIONS, .PATCH => true, .GET, .POST, .PUT, .DELETE, .CONNECT, .OPTIONS, .PATCH => true,
.HEAD, .PUT, .TRACE => false, .HEAD, .TRACE => false,
}; };
} }