阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js http2 request.headers

      Node.js http2 request.headers

      新增于: v8.4.0

      • < Object>

      The request/response headers object.

      Key-value pairs of header names and values. Header names are lower-cased.

      // Prints something like:
      //
      // { 'user-agent': 'curl/7.22.0',
      //   host: '127.0.0.1:8000',
      //   accept: '*/*' }
      console.log(request.headers);
      

      See HTTP/2 Headers Object.

      In HTTP/2, the request path, hostname, protocol, and method are represented as special headers prefixed with the : character (e.g. ‘:path’). These special headers will be included in the request.headers object. Care must be taken not to inadvertently modify these special headers or errors may occur. For instance, removing all headers from the request will cause errors to occur:

      removeAllHeaders(request.headers);
      assert(request.url);   // Fails because the :path header has been removed
      

      更多内容请参考:Node.js HTTP2,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录