Skip to content

Commit e5ef103

Browse files
committed
Fix #3194 correct url documentation
1 parent 35bcb1d commit e5ef103

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

doc/api/url.markdown

+36-19
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,51 @@ string will not be in the parsed object. Examples are shown for the URL
1313

1414
* `href`: The full URL that was originally parsed. Both the protocol and host are lowercased.
1515

16-
Example: `'http://user:[email protected]:8080/p/a/t/h?query=string#hash'`
16+
Example: `'http://user:[email protected]:8080/p/a/t/h?query=string#hash'`
17+
1718
* `protocol`: The request protocol, lowercased.
1819

19-
Example: `'http:'`
20-
* `host`: The full lowercased host portion of the URL, including port and authentication information.
20+
Example: `'http:'`
21+
22+
* `host`: The full lowercased host portion of the URL, including port
23+
information.
24+
25+
Example: `'host.com:8080'`
2126

22-
Example: `'user:[email protected]:8080'`
2327
* `auth`: The authentication information portion of a URL.
2428

25-
Example: `'user:pass'`
29+
Example: `'user:pass'`
30+
2631
* `hostname`: Just the lowercased hostname portion of the host.
2732

28-
Example: `'host.com'`
33+
Example: `'host.com'`
34+
2935
* `port`: The port number portion of the host.
3036

31-
Example: `'8080'`
32-
* `pathname`: The path section of the URL, that comes after the host and before the query, including the initial slash if present.
37+
Example: `'8080'`
3338

34-
Example: `'/p/a/t/h'`
35-
* `search`: The 'query string' portion of the URL, including the leading question mark.
39+
* `pathname`: The path section of the URL, that comes after the host and
40+
before the query, including the initial slash if present.
41+
42+
Example: `'/p/a/t/h'`
43+
44+
* `search`: The 'query string' portion of the URL, including the leading
45+
question mark.
46+
47+
Example: `'?query=string'`
3648

37-
Example: `'?query=string'`
3849
* `path`: Concatenation of `pathname` and `search`.
3950

40-
Example: `'/p/a/t/h?query=string'`
41-
* `query`: Either the 'params' portion of the query string, or a querystring-parsed object.
51+
Example: `'/p/a/t/h?query=string'`
52+
53+
* `query`: Either the 'params' portion of the query string, or a
54+
querystring-parsed object.
55+
56+
Example: `'query=string'` or `{'query':'string'}`
4257

43-
Example: `'query=string'` or `{'query':'string'}`
4458
* `hash`: The 'fragment' portion of the URL including the pound-sign.
4559

46-
Example: `'#hash'`
60+
Example: `'#hash'`
4761

4862
The following methods are provided by the URL module:
4963

@@ -65,9 +79,11 @@ Take a parsed URL object, and return a formatted URL string.
6579

6680
* `href` will be ignored.
6781
* `protocol`is treated the same with or without the trailing `:` (colon).
68-
* The protocols `http`, `https`, `ftp`, `gopher`, `file` will be postfixed with `://` (colon-slash-slash).
69-
* All other protocols `mailto`, `xmpp`, `aim`, `sftp`, `foo`, etc will be postfixed with `:` (colon)
70-
* `auth` will only be used if `host` is absent.
82+
* The protocols `http`, `https`, `ftp`, `gopher`, `file` will be
83+
postfixed with `://` (colon-slash-slash).
84+
* All other protocols `mailto`, `xmpp`, `aim`, `sftp`, `foo`, etc will
85+
be postfixed with `:` (colon)
86+
* `auth` will be used if present.
7187
* `hostname` will only be used if `host` is absent.
7288
* `port` will only be used if `host` is absent.
7389
* `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.
7995

8096
## url.resolve(from, to)
8197

82-
Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.
98+
Take a base URL, and a href URL, and resolve them as a browser would for
99+
an anchor tag.

0 commit comments

Comments
 (0)