Skip to content

net/http: Request.ParseForm doesn't support PATCH requests #7454

Closed
@mattetti

Description

@mattetti
HTTP PATCH requests are defined in this rfc: https://tools.ietf.org/html/rfc5789

The problem is that the current implementation for ParseForm is hardcoded to only parse
forms coming from POST or PUT requests, ignoring PATCH requests:

https://code.google.com/p/go/source/browse/src/pkg/net/http/request.go#731

The PostForm field should also be populated when making PATCH requests, from what I
could see, the underlying parsePostForm function wouldn't have an issue parsing a PATCH
request but we have a condition check that is preventing the parsing:

if r.Method == "POST" || r.Method == "PUT" {
    r.PostForm, err = parsePostForm(r)
}

I would gladly submit a patch but I have yet to understand the process to create a
codereview request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions