summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-04-30 10:30:05 -0700
committerisaacs <i@izs.me>2012-04-30 13:09:31 -0700
commite5ef103b05059d066abb6465b05772c90dfcf219 (patch)
treed5e2d77001fae78c7e2c19d9c2d6f18c2ccb8d76 /doc
parent35bcb1d6a96252a1711675dfc9615be835bc26b8 (diff)
downloadnodejs-e5ef103b05059d066abb6465b05772c90dfcf219.tar.gz
nodejs-e5ef103b05059d066abb6465b05772c90dfcf219.tar.bz2
nodejs-e5ef103b05059d066abb6465b05772c90dfcf219.zip
Fix #3194 correct url documentation
Diffstat (limited to 'doc')
-rw-r--r--doc/api/url.markdown55
1 files changed, 36 insertions, 19 deletions
diff --git a/doc/api/url.markdown b/doc/api/url.markdown
index 026766130..326aaf481 100644
--- a/doc/api/url.markdown
+++ b/doc/api/url.markdown
@@ -13,37 +13,51 @@ string will not be in the parsed object. Examples are shown for the URL
* `href`: The full URL that was originally parsed. Both the protocol and host are lowercased.
- Example: `'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'`
+ Example: `'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'`
+
* `protocol`: The request protocol, lowercased.
- Example: `'http:'`
-* `host`: The full lowercased host portion of the URL, including port and authentication information.
+ Example: `'http:'`
+
+* `host`: The full lowercased host portion of the URL, including port
+ information.
+
+ Example: `'host.com:8080'`
- Example: `'user:pass@host.com:8080'`
* `auth`: The authentication information portion of a URL.
- Example: `'user:pass'`
+ Example: `'user:pass'`
+
* `hostname`: Just the lowercased hostname portion of the host.
- Example: `'host.com'`
+ Example: `'host.com'`
+
* `port`: The port number portion of the host.
- Example: `'8080'`
-* `pathname`: The path section of the URL, that comes after the host and before the query, including the initial slash if present.
+ Example: `'8080'`
- Example: `'/p/a/t/h'`
-* `search`: The 'query string' portion of the URL, including the leading question mark.
+* `pathname`: The path section of the URL, that comes after the host and
+ before the query, including the initial slash if present.
+
+ Example: `'/p/a/t/h'`
+
+* `search`: The 'query string' portion of the URL, including the leading
+ question mark.
+
+ Example: `'?query=string'`
- Example: `'?query=string'`
* `path`: Concatenation of `pathname` and `search`.
- Example: `'/p/a/t/h?query=string'`
-* `query`: Either the 'params' portion of the query string, or a querystring-parsed object.
+ Example: `'/p/a/t/h?query=string'`
+
+* `query`: Either the 'params' portion of the query string, or a
+ querystring-parsed object.
+
+ Example: `'query=string'` or `{'query':'string'}`
- Example: `'query=string'` or `{'query':'string'}`
* `hash`: The 'fragment' portion of the URL including the pound-sign.
- Example: `'#hash'`
+ Example: `'#hash'`
The following methods are provided by the URL module:
@@ -65,9 +79,11 @@ Take a parsed URL object, and return a formatted URL string.
* `href` will be ignored.
* `protocol`is treated the same with or without the trailing `:` (colon).
- * The protocols `http`, `https`, `ftp`, `gopher`, `file` will be postfixed with `://` (colon-slash-slash).
- * All other protocols `mailto`, `xmpp`, `aim`, `sftp`, `foo`, etc will be postfixed with `:` (colon)
-* `auth` will only be used if `host` is absent.
+ * The protocols `http`, `https`, `ftp`, `gopher`, `file` will be
+ postfixed with `://` (colon-slash-slash).
+ * All other protocols `mailto`, `xmpp`, `aim`, `sftp`, `foo`, etc will
+ be postfixed with `:` (colon)
+* `auth` will be used if present.
* `hostname` will only be used if `host` is absent.
* `port` will only be used if `host` is absent.
* `host` will be used in place of `auth`, `hostname`, and `port`
@@ -79,4 +95,5 @@ Take a parsed URL object, and return a formatted URL string.
## url.resolve(from, to)
-Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.
+Take a base URL, and a href URL, and resolve them as a browser would for
+an anchor tag.