Skip to content

Commit 9acd6c9

Browse files
styfleTimothyGu
authored andcommitted
doc: add sub domain to host in url
PR-URL: nodejs#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 8460284 commit 9acd6c9

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

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

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

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

335335
*Note*: WHATWG URL's `origin` property includes `protocol` and `host`, but not
336336
`username` or `password`.
337337

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

0 commit comments

Comments
 (0)