Skip to content

proposal: net/http: Request.ParseForm implementation #72963

@Guest-615695028

Description

@Guest-615695028

Proposal Details

It would help to simplify code if we follow:

func (r *Request) ParseForm() (err error) {
	if r.PostForm == nil {
		switch r.Method {
			case "POST", "PUT", "PATCH": r.PostForm, err = parsePostForm(r)
		}
		if r.PostForm == nil {
			r.PostForm = make(url.Values)
		}
	}
	if r.Form == nil {r.Form = make(url.Values)}
	if len(r.PostForm) > 0 {copyValues(r.Form, r.PostForm)}
	if r.URL != nil {
		form, e := url.ParseQuery(r.URL.RawQuery)
		if err == nil {err = e}
		copyValues(r.Form, form)
	}
	return err
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions