美文网首页
node的请求数据

node的请求数据

作者: 半夏半暖半倾城灬 | 来源:发表于2018-04-06 16:00 被阅读0次

    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;

    相关文章

      网友评论

          本文标题:node的请求数据

          本文链接:https://www.haomeiwen.com/subject/wwrshftx.html