-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
The documentation for the URL
type states that
The Parse function sets both Path and RawPath in the URL it returns, and URL's String method uses RawPath if it is a valid encoding of Path, by calling the EscapedPath method. [emphasis added]
which makes it sound like it will always be set but this is not the case.
In the parse()
function called by Parse()
and ParseRequestURI()
, a comment states that it sets Path
and, optionally, RawPath. [...] We don't want to set it if the default escaping of Path is equivalent, to help make sure that people don't rely on it in general. [emphasis added]
For example:
Parsing "/foo" sets Path
as "/foo" but does not set RawPath
.
Parsing "%2Ffoo" sets the same Path
, "/foo", but also sets RawPath
as "%2Ffoo".
(see: https://play.golang.org/p/8R2_iCLDdrS)
This is unexpected behavior based on the public package documentation, which should be updated.