Skip to content

Commit 2fb2289

Browse files
styfleItalo A. Casas
authored andcommitted
doc: add sub domain to host in url
PR-URL: #12233 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent ac200a6 commit 2fb2289

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

doc/api/url.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ When parsed, a URL object is returned containing properties for each of these
1616
components.
1717

1818
The following details each of the components of a parsed URL. The example
19-
`'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'` is used to
19+
`'http://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'` is used to
2020
illustrate each.
2121

2222
```txt
23-
┌─────────────────────────────────────────────────────────────────────────────┐
24-
│ href │
25-
├──────────┬┬───────────┬─────────────────┬───────────────────────────┬───────┤
26-
│ protocol ││ auth │ host │ path │ hash │
27-
│ ││ ├──────────┬──────┼──────────┬────────────────┤ │
28-
│ ││ │ hostname │ port │ pathname │ search │ │
29-
│ ││ │ │ │ ├─┬──────────────┤ │
30-
│ ││ │ │ │ │ │ query │ │
31-
" http: // user:pass @ host.com : 8080 /p/a/t/h ? query=string #hash "
32-
│ ││ │ │ │ │ │ │ │
33-
└──────────┴┴───────────┴──────────┴──────┴──────────┴─┴──────────────┴───────┘
23+
┌─────────────────────────────────────────────────────────────────────────────────
24+
href
25+
├──────────┬┬───────────┬─────────────────────┬───────────────────────────┬───────┤
26+
│ protocol ││ auth │ host │ path │ hash │
27+
│ ││ ├──────────────┬──────┼──────────┬────────────────┤ │
28+
│ ││ │ hostname │ port │ pathname │ search │ │
29+
│ ││ │ │ │ ├─┬──────────────┤ │
30+
│ ││ │ │ │ │ │ query │ │
31+
" http: // user:pass @ sub.host.com : 8080 /p/a/t/h ? query=string #hash "
32+
│ ││ │ │ │ │ │ │ │
33+
└──────────┴┴───────────┴──────────────┴──────┴──────────┴─┴──────────────┴───────┘
3434
(all spaces in the "" line should be ignored -- they are purely for formatting)
3535
```
3636

@@ -56,21 +56,21 @@ For example: `'#hash'`
5656
The `host` property is the full lower-cased host portion of the URL, including
5757
the `port` if specified.
5858

59-
For example: `'host.com:8080'`
59+
For example: `'sub.host.com:8080'`
6060

6161
### urlObject.hostname
6262

6363
The `hostname` property is the lower-cased host name portion of the `host`
6464
component *without* the `port` included.
6565

66-
For example: `'host.com'`
66+
For example: `'sub.host.com'`
6767

6868
### urlObject.href
6969

7070
The `href` property is the full URL string that was parsed with both the
7171
`protocol` and `host` components converted to lower-case.
7272

73-
For example: `'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'`
73+
For example: `'http://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'`
7474

7575
### urlObject.path
7676

@@ -324,31 +324,31 @@ console.log(myURL.pathname); // /foo
324324
`delete myURL.pathname`, etc) has no effect but will still return `true`.
325325

326326
A comparison between this API and `url.parse()` is given below. Above the URL
327-
`'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'`, properties of an
327+
`'http://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'`, properties of an
328328
object returned by `url.parse()` are shown. Below it are properties of a WHATWG
329329
`URL` object.
330330

331331
*Note*: WHATWG URL's `origin` property includes `protocol` and `host`, but not
332332
`username` or `password`.
333333

334334
```txt
335-
┌─────────────────────────────────────────────────────────────────────────────────────────┐
336-
│ href │
337-
├──────────┬──┬─────────────────────┬─────────────────┬───────────────────────────┬───────┤
338-
│ protocol │ │ auth │ host │ path │ hash │
339-
│ │ │ ├──────────┬──────┼──────────┬────────────────┤ │
340-
│ │ │ │ hostname │ port │ pathname │ search │ │
341-
│ │ │ │ │ │ ├─┬──────────────┤ │
342-
│ │ │ │ │ │ │ │ query │ │
343-
" http: // user : pass @ host.com : 8080 /p/a/t/h ? query=string #hash "
344-
│ │ │ │ │ hostname │ port │ │ │ │
345-
│ │ │ │ ├──────────┴──────┤ │ │ │
346-
│ protocol │ │ username │ password │ host │ │ │ │
347-
├──────────┴──┼──────────┴──────────┼─────────────────┤ │ │ │
348-
│ origin │ │ origin │ pathname │ search │ hash │
349-
├─────────────┴─────────────────────┴─────────────────┴──────────┴────────────────┴───────┤
350-
│ href │
351-
└─────────────────────────────────────────────────────────────────────────────────────────┘
335+
┌─────────────────────────────────────────────────────────────────────────────────────────────
336+
href
337+
├──────────┬──┬─────────────────────┬─────────────────────┬───────────────────────────┬───────┤
338+
│ protocol │ │ auth │ host │ path │ hash │
339+
│ │ │ ├──────────────┬──────┼──────────┬────────────────┤ │
340+
│ │ │ │ hostname │ port │ pathname │ search │ │
341+
│ │ │ │ │ │ ├─┬──────────────┤ │
342+
│ │ │ │ │ │ │ │ query │ │
343+
" http: // user : pass @ sub.host.com : 8080 /p/a/t/h ? query=string #hash "
344+
│ │ │ │ │ hostname │ port │ │ │ │
345+
│ │ │ │ ├──────────────┴──────┤ │ │ │
346+
│ protocol │ │ username │ password │ host │ │ │ │
347+
├──────────┴──┼──────────┴──────────┼─────────────────────┤ │ │ │
348+
│ origin │ │ origin │ pathname │ search │ hash │
349+
├─────────────┴─────────────────────┴─────────────────────┴──────────┴────────────────┴───────┤
350+
href
351+
└─────────────────────────────────────────────────────────────────────────────────────────────
352352
(all spaces in the "" line should be ignored -- they are purely for formatting)
353353
```
354354

0 commit comments

Comments
 (0)