阿西河

所有教程

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

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js http2 response.getHeaders

      Node.js http2 response.getHeaders

      新增于: v8.4.0

      • Returns: < Object>

      Returns a shallow copy of the current outgoing headers. Since a shallow copy is used, array values may be mutated without additional calls to various header-related http module methods. The keys of the returned object are the header names and the values are the respective header values. All header names are lowercase.

      The object returned by the response.getHeaders() method does not prototypically inherit from the JavaScript Object. This means that typical Object methods such as obj.toString(), obj.hasOwnProperty(), and others are not defined and will not work.

      response.setHeader('Foo', 'bar');
      response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);
      
      const headers = response.getHeaders();
      // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
      

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


      目录
      本文目录
      目录