假设url:http://localhost:8080/user/id?name=zzh&age=18#ha
- http.IncomingMessage的message.url返回的是
/user/id?name=zzh&age=18 - url.parse(url,true) 返回一个url对象
{
href: ‘http://localhost:8080/user/id?name=zzh&age=18#ha’,
origin: ‘http://localhost:8080’,
protocol: ‘http:’,
username: ‘’,
password: ‘’,
host: ‘localhost:8080’,
hostname: ‘localhost’,
port: ‘8080’,
pathname: ‘/user/id’,
search: ‘?name=zzh&age=18’,
searchParams: URLSearchParams { ‘name’ => ‘zzh’, ‘age’ => ‘18’ },
hash: ‘#ha’
}