@@ -3092,46 +3092,25 @@ Then `request.url` will be:
3092
3092
' /status?name=ryan'
3093
3093
```
3094
3094
3095
- To parse the url into its parts, [ ` url.parse(request.url) ` ] [ `url.parse()` ] .
3095
+ To parse the url into its parts, ` new URL() ` can be used:
3096
3096
3097
3097
``` console
3098
3098
$ node
3099
- > url.parse(' /status?name=ryan' )
3100
- Url {
3101
- protocol: null,
3102
- slashes: null,
3103
- auth: null,
3104
- host: null,
3105
- port: null,
3106
- hostname: null,
3107
- hash: null,
3108
- search: '?name=ryan',
3109
- query: 'name=ryan',
3099
+ > new URL(' /status?name=ryan' , ' http://example.com' )
3100
+ URL {
3101
+ href: 'http://example.com/status?name=ryan',
3102
+ origin: 'http://example.com',
3103
+ protocol: 'http:',
3104
+ username: '',
3105
+ password: '',
3106
+ host: 'example.com',
3107
+ hostname: 'example.com',
3108
+ port: '',
3110
3109
pathname: '/status',
3111
- path: '/status?name=ryan',
3112
- href: '/status?name=ryan' }
3113
- ```
3114
-
3115
- To obtain the parameters from the query string, use the
3116
- [ ` querystring.parse() ` ] [ ] function or pass
3117
- ` true ` as the second argument to [ ` url.parse() ` ] [ ] .
3118
-
3119
- ``` console
3120
- $ node
3121
- > url.parse(' /status?name=ryan' , true)
3122
- Url {
3123
- protocol: null,
3124
- slashes: null,
3125
- auth: null,
3126
- host: null,
3127
- port: null,
3128
- hostname: null,
3129
- hash: null,
3130
3110
search: '?name=ryan',
3131
- query: { name: 'ryan' },
3132
- pathname: '/status',
3133
- path: '/status?name=ryan',
3134
- href: '/status?name=ryan' }
3111
+ searchParams: URLSearchParams { 'name' => 'ryan' },
3112
+ hash: ''
3113
+ }
3135
3114
```
3136
3115
3137
3116
### Class: ` http2.Http2ServerResponse `
@@ -3704,7 +3683,6 @@ following additional properties:
3704
3683
[ `net.Socket.prototype.unref()` ] : net.html#net_socket_unref
3705
3684
[ `net.Socket` ] : net.html#net_class_net_socket
3706
3685
[ `net.connect()` ] : net.html#net_net_connect
3707
- [ `querystring.parse()` ] : querystring.html#querystring_querystring_parse_str_sep_eq_options
3708
3686
[ `request.socket` ] : #http2_request_socket
3709
3687
[ `request.socket.getPeerCertificate()` ] : tls.html#tls_tlssocket_getpeercertificate_detailed
3710
3688
[ `response.end()` ] : #http2_response_end_data_encoding_callback
@@ -3719,6 +3697,5 @@ following additional properties:
3719
3697
[ `tls.TLSSocket` ] : tls.html#tls_class_tls_tlssocket
3720
3698
[ `tls.connect()` ] : tls.html#tls_tls_connect_options_callback
3721
3699
[ `tls.createServer()` ] : tls.html#tls_tls_createserver_options_secureconnectionlistener
3722
- [ `url.parse()` ] : url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
3723
3700
[ error code ] : #error_codes
3724
3701
[ `writable.writableFinished` ] : stream.html#stream_writable_writablefinished
0 commit comments