diff --git a/src/net/url/example_test.go b/src/net/url/example_test.go index 7f2eb2c3542..645de2e9092 100644 --- a/src/net/url/example_test.go +++ b/src/net/url/example_test.go @@ -84,3 +84,17 @@ func ExampleURL_opaque() { // Accept-Encoding: gzip // } + +func ExampleURL_ResolveReference() { + u, err := url.Parse("../../..//search?q=dotnet") + if err != nil { + log.Fatal(err) + } + base, err := url.Parse("http://example.com/directory/") + if err != nil { + log.Fatal(err) + } + fmt.Println(base.ResolveReference(u)) + // Output: + // http://example.com/search?q=dotnet +}