|
|
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="theme-color" content="#375EAB">
<title>url - The Go Programming Language</title>
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css">
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> <script type="text/javascript">window.initFuncs = [];</script> </head> <body>
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> ... </div><!-- #lowframe -->
<div id="topbar" class="wide"><div class="container"> <div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> <div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> <a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> <form method="GET" action="http://localhost:6060/search"> <div id="menu"> <a href="http://localhost:6060/doc/">Documents</a> <a href="http://localhost:6060/pkg/">Packages</a> <a href="http://localhost:6060/project/">The Project</a> <a href="http://localhost:6060/help/">Help</a> <a href="http://localhost:6060/blog/">Blog</a>
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> </div> </form>
</div></div>
<div id="page" class="wide"> <div class="container">
<h1>Package url</h1>
<div id="nav"></div>
<!--
Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <!--
Note: Static (i.e., not template-generated) href and id attributes start with "pkg-" to make it impossible for them to conflict with generated attributes (some of which correspond to Go identifiers). -->
<script type='text/javascript'> document.ANALYSIS_DATA = null; document.CALLGRAPH = null; </script>
<div id="short-nav"> <dl> <dd><code>import "net/url"</code></dd> </dl> <dl> <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> <dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> <dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> </dl> </div> <!-- The package's Name is printed as title by the top-level template --> <div id="pkg-overview" class="toggleVisible"> <div class="collapsed"> <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> </div> <div class="expanded"> <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> <p> Package url parses URLs and implements query escaping. See RFC 3986. </p>
</div> </div>
<div id="pkg-index" class="toggleVisible"> <div class="collapsed"> <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> </div> <div class="expanded"> <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> <div id="manual-nav"> <dl> <dd><a href="index.html#QueryEscape">func QueryEscape(s string) string</a></dd> <dd><a href="index.html#QueryUnescape">func QueryUnescape(s string) (string, error)</a></dd> <dd><a href="index.html#Error">type Error</a></dd> <dd> <a href="index.html#Error.Error">func (e *Error) Error() string</a></dd> <dd> <a href="index.html#Error.Temporary">func (e *Error) Temporary() bool</a></dd> <dd> <a href="index.html#Error.Timeout">func (e *Error) Timeout() bool</a></dd> <dd><a href="index.html#EscapeError">type EscapeError</a></dd> <dd> <a href="index.html#EscapeError.Error">func (e EscapeError) Error() string</a></dd> <dd><a href="index.html#InvalidHostError">type InvalidHostError</a></dd> <dd> <a href="index.html#InvalidHostError.Error">func (e InvalidHostError) Error() string</a></dd> <dd><a href="index.html#URL">type URL</a></dd> <dd> <a href="index.html#Parse">func Parse(rawurl string) (url *URL, err error)</a></dd> <dd> <a href="index.html#ParseRequestURI">func ParseRequestURI(rawurl string) (url *URL, err error)</a></dd> <dd> <a href="index.html#URL.EscapedPath">func (u *URL) EscapedPath() string</a></dd> <dd> <a href="index.html#URL.IsAbs">func (u *URL) IsAbs() bool</a></dd> <dd> <a href="index.html#URL.Parse">func (u *URL) Parse(ref string) (*URL, error)</a></dd> <dd> <a href="index.html#URL.Query">func (u *URL) Query() Values</a></dd> <dd> <a href="index.html#URL.RequestURI">func (u *URL) RequestURI() string</a></dd> <dd> <a href="index.html#URL.ResolveReference">func (u *URL) ResolveReference(ref *URL) *URL</a></dd> <dd> <a href="index.html#URL.String">func (u *URL) String() string</a></dd> <dd><a href="index.html#Userinfo">type Userinfo</a></dd> <dd> <a href="index.html#User">func User(username string) *Userinfo</a></dd> <dd> <a href="index.html#UserPassword">func UserPassword(username, password string) *Userinfo</a></dd> <dd> <a href="index.html#Userinfo.Password">func (u *Userinfo) Password() (string, bool)</a></dd> <dd> <a href="index.html#Userinfo.String">func (u *Userinfo) String() string</a></dd> <dd> <a href="index.html#Userinfo.Username">func (u *Userinfo) Username() string</a></dd> <dd><a href="index.html#Values">type Values</a></dd> <dd> <a href="index.html#ParseQuery">func ParseQuery(query string) (m Values, err error)</a></dd> <dd> <a href="index.html#Values.Add">func (v Values) Add(key, value string)</a></dd> <dd> <a href="index.html#Values.Del">func (v Values) Del(key string)</a></dd> <dd> <a href="index.html#Values.Encode">func (v Values) Encode() string</a></dd> <dd> <a href="index.html#Values.Get">func (v Values) Get(key string) string</a></dd> <dd> <a href="index.html#Values.Set">func (v Values) Set(key, value string)</a></dd> </dl> </div><!-- #manual-nav -->
<div id="pkg-examples"> <h4>Examples</h4> <dl> <dd><a class="exampleLink" href="index.html#example_URL">URL</a></dd> <dd><a class="exampleLink" href="index.html#example_URL_ResolveReference">URL.ResolveReference</a></dd> <dd><a class="exampleLink" href="index.html#example_URL_opaque">URL (Opaque)</a></dd> <dd><a class="exampleLink" href="index.html#example_URL_roundtrip">URL (Roundtrip)</a></dd> <dd><a class="exampleLink" href="index.html#example_Values">Values</a></dd> </dl> </div>
<h4>Package files</h4> <p> <span style="font-size:90%"> <a href="http://localhost:6060/src/net/url/url.go">url.go</a> </span> </p> </div><!-- .expanded --> </div><!-- #pkg-index -->
<div id="pkg-callgraph" class="toggle" style="display: none"> <div class="collapsed"> <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> </div> <!-- .expanded --> <div class="expanded"> <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> <p> In the call graph viewer below, each node is a function belonging to this package and its children are the functions it calls—perhaps dynamically. </p> <p> The root nodes are the entry points of the package: functions that may be called from outside the package. There may be non-exported or anonymous functions among them if they are called dynamically from another package. </p> <p> Click a node to visit that function's source code. From there you can visit its callers by clicking its declaring <code>func</code> token. </p> <p> Functions may be omitted if they were determined to be unreachable in the particular programs or tests that were analyzed. </p> <!-- Zero means show all package entry points. --> <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> </div> </div> <!-- #pkg-callgraph -->
<h2 id="QueryEscape">func <a href="http://localhost:6060/src/net/url/url.go?s=6331:6364#L235">QueryEscape</a></h2> <pre>func QueryEscape(s <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#string">string</a></pre> <p> QueryEscape escapes the string so it can be safely placed inside a URL query. </p>
<h2 id="QueryUnescape">func <a href="http://localhost:6060/src/net/url/url.go?s=4059:4103#L149">QueryUnescape</a></h2> <pre>func QueryUnescape(s <a href="../../builtin/index.html#string">string</a>) (<a href="../../builtin/index.html#string">string</a>, <a href="../../builtin/index.html#error">error</a>)</pre> <p> QueryUnescape does the inverse transformation of QueryEscape, converting %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits. </p>
<h2 id="Error">type <a href="http://localhost:6060/src/net/url/url.go?s=384:440#L9">Error</a></h2> <pre>type Error struct { Op <a href="../../builtin/index.html#string">string</a> URL <a href="../../builtin/index.html#string">string</a> Err <a href="../../builtin/index.html#error">error</a> }</pre> <p> Error reports an error and the operation and URL that caused it. </p>
<h3 id="Error.Error">func (*Error) <a href="http://localhost:6060/src/net/url/url.go?s=442:472#L15">Error</a></h3> <pre>func (e *<a href="index.html#Error">Error</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> <h3 id="Error.Temporary">func (*Error) <a href="http://localhost:6060/src/net/url/url.go?s=707:739#L30">Temporary</a></h3> <pre>func (e *<a href="index.html#Error">Error</a>) Temporary() <a href="../../builtin/index.html#bool">bool</a></pre> <h3 id="Error.Timeout">func (*Error) <a href="http://localhost:6060/src/net/url/url.go?s=571:601#L21">Timeout</a></h3> <pre>func (e *<a href="index.html#Error">Error</a>) Timeout() <a href="../../builtin/index.html#bool">bool</a></pre> <h2 id="EscapeError">type <a href="http://localhost:6060/src/net/url/url.go?s=1324:1347#L70">EscapeError</a></h2> <pre>type EscapeError <a href="../../builtin/index.html#string">string</a></pre>
<h3 id="EscapeError.Error">func (EscapeError) <a href="http://localhost:6060/src/net/url/url.go?s=1349:1384#L72">Error</a></h3> <pre>func (e <a href="index.html#EscapeError">EscapeError</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> <h2 id="InvalidHostError">type <a href="http://localhost:6060/src/net/url/url.go?s=1447:1475#L76">InvalidHostError</a></h2> <pre>type InvalidHostError <a href="../../builtin/index.html#string">string</a></pre>
<h3 id="InvalidHostError.Error">func (InvalidHostError) <a href="http://localhost:6060/src/net/url/url.go?s=1477:1517#L78">Error</a></h3> <pre>func (e <a href="index.html#InvalidHostError">InvalidHostError</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> <h2 id="URL">type <a href="http://localhost:6060/src/net/url/url.go?s=8162:8553#L299">URL</a></h2> <pre>type URL struct { Scheme <a href="../../builtin/index.html#string">string</a> Opaque <a href="../../builtin/index.html#string">string</a> <span class="comment">// encoded opaque data</span> User *<a href="index.html#Userinfo">Userinfo</a> <span class="comment">// username and password information</span> Host <a href="../../builtin/index.html#string">string</a> <span class="comment">// host or host:port</span> Path <a href="../../builtin/index.html#string">string</a> RawPath <a href="../../builtin/index.html#string">string</a> <span class="comment">// encoded path hint (Go 1.5 and later only; see EscapedPath method)</span> RawQuery <a href="../../builtin/index.html#string">string</a> <span class="comment">// encoded query values, without '?'</span> Fragment <a href="../../builtin/index.html#string">string</a> <span class="comment">// fragment for references, without '#'</span> }</pre> <p> A URL represents a parsed URL (technically, a URI reference). The general form represented is: </p> <pre>scheme://[userinfo@]host/path[?query][#fragment] </pre> <p> URLs that do not start with a slash after the scheme are interpreted as: </p> <pre>scheme:opaque[?query][#fragment] </pre> <p> Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/. A consequence is that it is impossible to tell which slashes in the Path were slashes in the raw URL and which were %2f. This distinction is rarely important, but when it is, code must not use Path directly. </p> <p> Go 1.5 introduced the RawPath field to hold the encoded form of Path. 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. </p> <p> In earlier versions of Go, the more indirect workarounds were that an HTTP server could consult req.RequestURI and an HTTP client could construct a URL struct directly and set the Opaque field instead of Path. These still work as well. </p>
<div id="example_URL" class="toggle"> <div class="collapsed"> <p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> </div> <div class="expanded"> <p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> <p>Code:</p> <pre class="code">u, err := url.Parse("http://bing.com/search?q=dotnet") if err != nil { log.Fatal(err) } u.Scheme = "https" u.Host = "google.com" q := u.Query() q.Set("q", "golang") u.RawQuery = q.Encode() fmt.Println(u) <span class="comment"></pre> <p>Output:</p> <pre class="output">https://google.com/search?q=golang </pre> </div> </div> <div id="example_URL_opaque" class="toggle"> <div class="collapsed"> <p class="exampleHeading toggleButton">▹ <span class="text">Example (Opaque)</span></p> </div> <div class="expanded"> <p class="exampleHeading toggleButton">▾ <span class="text">Example (Opaque)</span></p> <p>Code:</p> <pre class="code"><span class="comment">// Sending a literal '%' in an HTTP request's Path</span> req := &http.Request{ Method: "GET", Host: "example.com", <span class="comment">// takes precedence over URL.Host</span> URL: &url.URL{ Host: "ignored", Scheme: "https", Opaque: "/%2f/", }, Header: http.Header{ "User-Agent": {"godoc-example/0.1"}, }, } out, err := httputil.DumpRequestOut(req, true) if err != nil { log.Fatal(err) } fmt.Println(strings.Replace(string(out), "\r", "", -1)) <span class="comment"></pre> <p>Output:</p> <pre class="output">GET /%2f/ HTTP/1.1 Host: example.com User-Agent: godoc-example/0.1 Accept-Encoding: gzip </pre> </div> </div> <div id="example_URL_roundtrip" class="toggle"> <div class="collapsed"> <p class="exampleHeading toggleButton">▹ <span class="text">Example (Roundtrip)</span></p> </div> <div class="expanded"> <p class="exampleHeading toggleButton">▾ <span class="text">Example (Roundtrip)</span></p> <p>Code:</p> <pre class="code"><span class="comment">// Parse + String preserve the original encoding.</span> u, err := url.Parse("https://example.com/foo%2fbar") if err != nil { log.Fatal(err) } fmt.Println(u.Path) fmt.Println(u.RawPath) fmt.Println(u.String()) <span class="comment"></pre> <p>Output:</p> <pre class="output">/foo/bar /foo%2fbar https://example.com/foo%2fbar </pre> </div> </div>
<h3 id="Parse">func <a href="http://localhost:6060/src/net/url/url.go?s=11220:11267#L403">Parse</a></h3> <pre>func Parse(rawurl <a href="../../builtin/index.html#string">string</a>) (url *<a href="index.html#URL">URL</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> <p> Parse parses rawurl into a URL structure. The rawurl may be relative or absolute. </p>
<h3 id="ParseRequestURI">func <a href="http://localhost:6060/src/net/url/url.go?s=11894:11951#L423">ParseRequestURI</a></h3> <pre>func ParseRequestURI(rawurl <a href="../../builtin/index.html#string">string</a>) (url *<a href="index.html#URL">URL</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> <p> ParseRequestURI parses rawurl into a URL structure. It assumes that rawurl was received in an HTTP request, so the rawurl is interpreted only as an absolute URI or an absolute path. The string rawurl is assumed not to have a #fragment suffix. (Web browsers strip #fragment before sending the URL to a web server.) </p>
<h3 id="URL.EscapedPath">func (*URL) <a href="http://localhost:6060/src/net/url/url.go?s=16370:16404#L577">EscapedPath</a></h3> <pre>func (u *<a href="index.html#URL">URL</a>) EscapedPath() <a href="../../builtin/index.html#string">string</a></pre> <p> EscapedPath returns the escaped form of u.Path. In general there are multiple possible escaped forms of any path. EscapedPath returns u.RawPath when it is a valid escaping of u.Path. Otherwise EscapedPath ignores u.RawPath and computes an escaped form on its own. The String and RequestURI methods use EscapedPath to construct their results. In general, code should call EscapedPath instead of reading u.RawPath directly. </p>
<h3 id="URL.IsAbs">func (*URL) <a href="http://localhost:6060/src/net/url/url.go?s=22627:22653#L834">IsAbs</a></h3> <pre>func (u *<a href="index.html#URL">URL</a>) IsAbs() <a href="../../builtin/index.html#bool">bool</a></pre> <p> IsAbs reports whether the URL is absolute. </p>
<h3 id="URL.Parse">func (*URL) <a href="http://localhost:6060/src/net/url/url.go?s=22891:22936#L841">Parse</a></h3> <pre>func (u *<a href="index.html#URL">URL</a>) Parse(ref <a href="../../builtin/index.html#string">string</a>) (*<a href="index.html#URL">URL</a>, <a href="../../builtin/index.html#error">error</a>)</pre> <p> Parse parses a URL in the context of the receiver. The provided URL may be relative or absolute. Parse returns nil, err on parse failure, otherwise its return value is the same as ResolveReference. </p>
<h3 id="URL.Query">func (*URL) <a href="http://localhost:6060/src/net/url/url.go?s=24144:24172#L887">Query</a></h3> <pre>func (u *<a href="index.html#URL">URL</a>) Query() <a href="index.html#Values">Values</a></pre> <p> Query parses RawQuery and returns the corresponding values. </p>
<h3 id="URL.RequestURI">func (*URL) <a href="http://localhost:6060/src/net/url/url.go?s=24336:24369#L894">RequestURI</a></h3> <pre>func (u *<a href="index.html#URL">URL</a>) RequestURI() <a href="../../builtin/index.html#string">string</a></pre> <p> RequestURI returns the encoded path?query or opaque?query string that would be used in an HTTP request for u. </p>
<h3 id="URL.ResolveReference">func (*URL) <a href="http://localhost:6060/src/net/url/url.go?s=23440:23485#L855">ResolveReference</a></h3> <pre>func (u *<a href="index.html#URL">URL</a>) ResolveReference(ref *<a href="index.html#URL">URL</a>) *<a href="index.html#URL">URL</a></pre> <p> ResolveReference resolves a URI reference to an absolute URI from an absolute base URI, per RFC 3986 Section 5.2. The URI reference may be relative or absolute. ResolveReference always returns a new URL instance, even if the returned URL is identical to either the base or reference. If ref is an absolute URL, then ResolveReference ignores base and returns a copy of ref. </p>
<div id="example_URL_ResolveReference" class="toggle"> <div class="collapsed"> <p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> </div> <div class="expanded"> <p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> <p>Code:</p> <pre class="code">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)) <span class="comment"></pre> <p>Output:</p> <pre class="output">http://example.com/search?q=dotnet </pre> </div> </div>
<h3 id="URL.String">func (*URL) <a href="http://localhost:6060/src/net/url/url.go?s=18579:18608#L652">String</a></h3> <pre>func (u *<a href="index.html#URL">URL</a>) String() <a href="../../builtin/index.html#string">string</a></pre> <p> String reassembles the URL into a valid URL string. The general form of the result is one of: </p> <pre>scheme:opaque?query#fragment scheme://userinfo@host/path?query#fragment </pre> <p> If u.Opaque is non-empty, String uses the first form; otherwise it uses the second form. To obtain the path, String uses u.EscapedPath(). </p> <p> In the second form, the following rules apply: </p> <pre>- if u.Scheme is empty, scheme: is omitted. - if u.User is nil, userinfo@ is omitted. - if u.Host is empty, host/ is omitted. - if u.Scheme and u.Host are empty and u.User is nil, the entire scheme://userinfo@host/ is omitted. - if u.Host is non-empty and u.Path begins with a /, the form host/path does not add its own /. - if u.RawQuery is empty, ?query is omitted. - if u.Fragment is empty, #fragment is omitted. </pre>
<h2 id="Userinfo">type <a href="http://localhost:6060/src/net/url/url.go?s=9457:9539#L331">Userinfo</a></h2> <pre>type Userinfo struct { <span class="comment">// contains filtered or unexported fields</span> }</pre> <p> The Userinfo type is an immutable encapsulation of username and password details for a URL. An existing Userinfo value is guaranteed to have a username set (potentially empty, as allowed by RFC 2396), and optionally a password. </p>
<h3 id="User">func <a href="http://localhost:6060/src/net/url/url.go?s=8639:8675#L312">User</a></h3> <pre>func User(username <a href="../../builtin/index.html#string">string</a>) *<a href="index.html#Userinfo">Userinfo</a></pre> <p> User returns a Userinfo containing the provided username and no password set. </p>
<h3 id="UserPassword">func <a href="http://localhost:6060/src/net/url/url.go?s=9113:9167#L323">UserPassword</a></h3> <pre>func UserPassword(username, password <a href="../../builtin/index.html#string">string</a>) *<a href="index.html#Userinfo">Userinfo</a></pre> <p> UserPassword returns a Userinfo containing the provided username and password. This functionality should only be used with legacy web sites. RFC 2396 warns that interpreting Userinfo this way “is NOT RECOMMENDED, because the passing of authentication information in clear text (such as URI) has proven to be a security risk in almost every case where it has been used.” </p>
<h3 id="Userinfo.Password">func (*Userinfo) <a href="http://localhost:6060/src/net/url/url.go?s=9711:9755#L343">Password</a></h3> <pre>func (u *<a href="index.html#Userinfo">Userinfo</a>) Password() (<a href="../../builtin/index.html#string">string</a>, <a href="../../builtin/index.html#bool">bool</a>)</pre> <p> Password returns the password in case it is set, and whether it is set. </p>
<h3 id="Userinfo.String">func (*Userinfo) <a href="http://localhost:6060/src/net/url/url.go?s=9929:9963#L352">String</a></h3> <pre>func (u *<a href="index.html#Userinfo">Userinfo</a>) String() <a href="../../builtin/index.html#string">string</a></pre> <p> String returns the encoded userinfo information in the standard form of "username[:password]". </p>
<h3 id="Userinfo.Username">func (*Userinfo) <a href="http://localhost:6060/src/net/url/url.go?s=9575:9611#L338">Username</a></h3> <pre>func (u *<a href="index.html#Userinfo">Userinfo</a>) Username() <a href="../../builtin/index.html#string">string</a></pre> <p> Username returns the username. </p>
<h2 id="Values">type <a href="http://localhost:6060/src/net/url/url.go?s=19545:19576#L692">Values</a></h2> <pre>type Values map[<a href="../../builtin/index.html#string">string</a>][]<a href="../../builtin/index.html#string">string</a></pre> <p> Values maps a string key to a list of values. It is typically used for query parameters and form values. Unlike in the http.Header map, the keys in a Values map are case-sensitive. </p>
<div id="example_Values" class="toggle"> <div class="collapsed"> <p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> </div> <div class="expanded"> <p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> <p>Code:</p> <pre class="code">v := url.Values{} v.Set("name", "Ava") v.Add("friend", "Jess") v.Add("friend", "Sarah") v.Add("friend", "Zoe") <span class="comment">// v.Encode() == "name=Ava&friend=Jess&friend=Sarah&friend=Zoe"</span> fmt.Println(v.Get("name")) fmt.Println(v.Get("friend")) fmt.Println(v["friend"]) <span class="comment"></pre> <p>Output:</p> <pre class="output">Ava Jess [Jess Sarah Zoe] </pre> </div> </div>
<h3 id="ParseQuery">func <a href="http://localhost:6060/src/net/url/url.go?s=20592:20643#L731">ParseQuery</a></h3> <pre>func ParseQuery(query <a href="../../builtin/index.html#string">string</a>) (m <a href="index.html#Values">Values</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> <p> ParseQuery parses the URL-encoded query string and returns a map listing the values specified for each key. ParseQuery always returns a non-nil map containing all the valid query parameters found; err describes the first decoding error encountered, if any. </p>
<h3 id="Values.Add">func (Values) <a href="http://localhost:6060/src/net/url/url.go?s=20144:20182#L717">Add</a></h3> <pre>func (v <a href="index.html#Values">Values</a>) Add(key, value <a href="../../builtin/index.html#string">string</a>)</pre> <p> Add adds the value to key. It appends to any existing values associated with key. </p>
<h3 id="Values.Del">func (Values) <a href="http://localhost:6060/src/net/url/url.go?s=20267:20298#L722">Del</a></h3> <pre>func (v <a href="index.html#Values">Values</a>) Del(key <a href="../../builtin/index.html#string">string</a>)</pre> <p> Del deletes the values associated with key. </p>
<h3 id="Values.Encode">func (Values) <a href="http://localhost:6060/src/net/url/url.go?s=21397:21428#L773">Encode</a></h3> <pre>func (v <a href="index.html#Values">Values</a>) Encode() <a href="../../builtin/index.html#string">string</a></pre> <p> Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") sorted by key. </p>
<h3 id="Values.Get">func (Values) <a href="http://localhost:6060/src/net/url/url.go?s=19773:19811#L698">Get</a></h3> <pre>func (v <a href="index.html#Values">Values</a>) Get(key <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#string">string</a></pre> <p> Get gets the first value associated with the given key. If there are no values associated with the key, Get returns the empty string. To access multiple values, use the map directly. </p>
<h3 id="Values.Set">func (Values) <a href="http://localhost:6060/src/net/url/url.go?s=19986:20024#L711">Set</a></h3> <pre>func (v <a href="index.html#Values">Values</a>) Set(key, value <a href="../../builtin/index.html#string">string</a>)</pre> <p> Set sets the key to value. It replaces any existing values. </p>
<div id="footer"> Build version go1.6.<br> Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> <a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> </div>
</div><!-- .container --> </div><!-- #page -->
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> <script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> <script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> <script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script>
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script>
</body> </html>
|