Skip to content

net/url: parseQuery() better support for array parse. #42293

@ainilili

Description

@ainilili

What version of Go are you using (go version)?

$ 1.15.3

Does this issue reproduce with the latest release?

yes

What did you do?

import (
	"fmt"
	"net/url"
)

func main(){
	query := "params=fo,fu,n%2Cico"
	values, err := url.ParseQuery(query)
	if err != nil{
		panic(err)
	}
	for _, vs := range values{
		for _, v := range vs{
			fmt.Println(v)
		}
	}
}

What did you expect to see?

fo
fu
n,ico

What did you see instead?

fo,fu,n,ico

When an Array parameter is passed by URL or application/ x-www-Form-urlencoded mode, many clients will define the request content in a comma-separated way, so can this expectation be met?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions