Skip to content

net/http/request: should not unescape url when calling NewRequest #7356

Closed
@gopherbot

Description

@gopherbot

by liyinkan:

version of Go: 1.2
os: mac os x

we request server via http.Get and escape the query "t/t"

u := "http://localhost:8888/test/id="; + url.QueryEscape("t/t")
resp, err := http.Get(u)
...

the input url should be http://localhost:8888/test/id=t%2Ft
but actual request is http://localhost:8888/test/id=t/t and server receives that, too.

found NewRequest called url.Parse(urlStr) first and url.Parse will unescape the %2F

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