headers:
{ host: '127.0.0.1:6300',
connection: 'keep-alive',
pragma: 'no-cache',
'x-requested-with':'XMLHttpRequest',//非ajax请求则无该字段req.headers['x-requested-with'] !='XMLHttpRequest'
'cache-control': 'no-cache',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9',
cookie: 'Hm_lvt_5479a362824bfa8ab8eb336cb5d1ba46=1522808541; Hm_lpvt_5479a362824bfa8ab8eb336cb5d1ba46=1522808541'
}
query: { code: '1111', state: '222', r: '19293847495495' }
body:{ code: '1111', state: '222', r: '19293847495495' }
params:{ code: '1111', state: '222', r: '19293847495495' }
Url {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null,
search: '?code=1111&state=222&r=19293847495495',
query: 'code=1111&state=222&r=19293847495495',
pathname: '/pm/manager/signin',
path: '/pm/manager/signin?code=1111&state=222&r=19293847495495',
href: '/pm/manager/signin?code=1111&state=222&r=19293847495495',
_raw: '/pm/manager/signin?code=1111&state=222&r=19293847495495'
}
originalUrl: '/pm/manager/signin?code=1111&state=222&r=19293847495495',
获取当前请求链接的方法:
var cur_url = req.protocol+"://"+req.headers.host+req.originalUrl;