Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/node:http/ClientRequest/setHeadersMsetHeadersmethod
http.ClientRequest.setHeaders { const headers = new Headers({ 'Content-Type': 'text/html' }); res.setHeaders(headers); res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('ok'); }); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">setHeaders(headers: Headers | Mapstring, string | number | readonly string[]>): this;Sets multiple header values for implicit headers. headers must be an instance of Headers or Map, if a header already exists in the to-be-sent headers, its value will be replaced.const headers = new Headers({ foo: 'bar' }); outgoingMessage.setHeaders(headers); orconst headers = new Map([['foo', 'bar']]); outgoingMessage.setHeaders(headers); When headers have been set with outgoingMessage.setHeaders(), they will be merged with any headers passed to response.writeHead(), with the headers passed to response.writeHead() given precedence.// Returns content-type = text/plain const server = http.createServer((req, res) => { const headers = new Headers({ 'Content-Type': 'text/html' }); res.setHeaders(headers); res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('ok'); }); Referenced typesclass HeadersThis Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.MDN Referencereadonly count: numberGet the total number of headers[Symbol.iterator](): HeadersIterator[string, string]>;append(name: string,value: string): void;MDN Referencedelete(name: string): void;MDN Referenceentries(): HeadersIterator[string, string]>;Returns an iterator allowing to go through all key/value pairs contained in this object.forEach(callbackfn: (value: string, key: string, parent: Headers) => void,thisArg?: any): void;get(name: string): null | string;MDN ReferencegetAll(name: 'set-cookie' | 'Set-Cookie'): string[];Get all headers matching the nameOnly supports "Set-Cookie". All other headers are empty arrays.@param nameThe header name to get@returnsAn array of header valuesconst headers = new Headers(); headers.append("Set-Cookie", "foo=bar"); headers.append("Set-Cookie", "baz=qux"); headers.getAll("Set-Cookie"); // ["foo=bar", "baz=qux"] getSetCookie(): string[];MDN Referencehas(name: string): boolean;MDN Referencekeys(): HeadersIteratorstring>;Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.set(name: string,value: string): void;MDN ReferencetoJSON(): Recordstring, string> & { set-cookie: string[] };Convert Headers to a plain JavaScript object.About 10x faster than Object.fromEntries(headers.entries())Called when you run JSON.stringify(headers)Does not preserve insertion order. Well-known header names are lowercased. Other header names are left as-is.values(): HeadersIteratorstring>;Returns an iterator allowing to go through all values of the key/value pairs contained in this object.Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San FranciscoWe're hiring →智能索引记录
-
2026-03-02 12:24:08
综合导航
成功
标题:Les personnes aux yeux bleus plus alcooliques que les autres ?
简介:Non, ce n’est pas une blague. La couleur de nos yeux pourrai
-
2026-03-02 18:12:35
电商商城
成功
标题:Hellokitty女童中长款棉服品牌及商品 - 京东
简介:京东是国内专业的Hellokitty女童中长款棉服网上购物商城,本频道提供Hellokitty女童中长款棉服哪个牌子好、
-
2026-03-02 17:03:57
游戏娱乐
成功
标题:蚂蚁运输车,蚂蚁运输车小游戏,4399小游戏 www.4399.com
简介:蚂蚁运输车在线玩,蚂蚁运输车下载, 蚂蚁运输车攻略秘籍.更多蚂蚁运输车游戏尽在4399小游戏,好玩记得告诉你的朋友哦!
-
2026-03-02 16:53:34
教育培训
成功
标题:童年趣事作文
简介:在日复一日的学习、工作或生活中,大家都尝试过写作文吧,作文是经过人的思想考虑和语言组织,通过文字来表达一个主题意义的记叙
-
2026-03-02 12:32:46
运动健身
成功
标题:分享幸福_600字_作文网
简介:如果一个人的幸福乘以二,就是双倍的幸福。幸福有许多种,有父母对自己的呵护,有老师对我的关心,有朋友对我的帮助。下面就和大
-
2026-03-02 12:21:18
综合导航
成功
标题:盘龙之大地传说最新章节_盘龙之大地传说小说免费全文阅读_恋上你看书网
简介:一个盘龙世界的土着少年意外融合了天外来客-来自地球的青年的灵魂,将会在盘龙世界掀起怎样的腥风血雨呢?
-
2026-03-02 18:54:50
综合导航
成功
标题:Database Integration Archives - Making Sense of the Infinite
简介:Database Integration Archives - Making Sense of the Infinite
-
2026-03-02 12:26:46
游戏娱乐
成功
标题:《突袭5》新宣传片 Demo已在Steam平台上线_3DM单机
简介:近日《突袭5》(Sudden Strike5)官方宣布,Demo试玩版已在Steam平台上线。本作将于2026年登陆PS
-
2026-03-02 14:38:56
图片素材
成功
标题:地方文化的作文3000字 描写地方文化的作文 关于地方文化的作文-作文网
简介:作文网精选关于地方文化的3000字作文,包含地方文化的作文素材,关于地方文化的作文题目,以地方文化为话题的3000字作文
-
2026-03-02 16:53:15
综合导航
成功
标题:Stunning iPhone 12 design video shows off brand new colour option T3
简介:All four iPhone 12 models are shown in seven bold colours in
-
2026-03-02 12:13:56
综合导航
成功
标题:Author: Ari Kaplan Law.com
简介:Ari Kaplan is a legal industry analyst who publishes benchma
-
2026-03-02 12:52:13
教育培训
成功
标题:精选我终于作文300字3篇
简介:在平时的学习、工作或生活中,大家都不可避免地会接触到作文吧,作文是经过人的思想考虑和语言组织,通过文字来表达一个主题意义
-
2026-03-02 17:56:19
综合导航
成功
标题:24H Hot Coins and News The Trump family denies any connection with Trump Wallet; pump.fun plans to sell tokens for $4 Bee Network
简介:1. Popular currencies on CEX CEX top 10 trading volume and
-
2026-03-02 18:08:47
综合导航
成功
标题:Buy iPad Accessories - Apple
简介:Shop accessories for your favorite iPad model. Apple Pencil
-
2026-03-02 17:03:47
综合导航
成功
标题:æ¦å¿çæ¼é³_æ¦å¿çææ_æ¦å¿çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½æ¦å¿é¢é,ä»ç»æ¦å¿,æ¦å¿çæ¼é³,æ¦å¿æ¯
-
2026-03-02 17:04:11
美妆护肤
成功
标题:娇韵诗清透乳哪款好?娇韵诗清透乳怎么样好用吗? - 京东
简介:小编为大家带来娇韵诗清透乳哪款好?娇韵诗清透乳怎么样好用吗?的文章,大家一起来看下相关内容吧。 1、Clarins娇韵诗
-
2026-03-02 18:53:54
综合导航
成功
标题:虚镜知音动漫免费观看最新章节最新章节_分卷阅读87第1页_虚镜知音动漫免费观看最新章节免费阅读_恋上你看书网
简介:分卷阅读87第1页_虚镜知音动漫免费观看最新章节_赵无_恋上你看书网
-
2026-03-02 12:42:17
教育培训
成功
标题:做月饼作文
简介:摘要:一年一度的中秋节到了,我们来到小桔灯,准备亲手做月饼。多么新鲜的事儿啊!多么令我们开心啊!材料一切就 如果觉得写得
-
2026-03-02 10:28:58
游戏娱乐
成功
标题:小汽车之童话梦_小汽车之童话梦html5游戏_4399h5游戏-4399小游戏
简介:小汽车之童话梦在线玩,小汽车之童话梦下载, 小汽车之童话梦攻略秘籍.更多小汽车之童话梦游戏尽在4399小游戏,好玩记得告
-
2026-03-02 13:59:32
综合导航
成功
标题:京东(JD.COM)-正品低价、品质保障、配送及时、轻松购物!
简介:京东JD.COM-专业的综合网上购物商城,为您提供正品低价的购物选择、优质便捷的服务体验。商品来自全球数十万品牌商家,囊
-
2026-03-02 18:53:58
综合导航
成功
标题:九州之王叶凌天陈潇染最新章节_第33章妻子感激第1页_九州之王叶凌天陈潇染免费章节_恋上你看书网
简介:第33章妻子感激第1页_九州之王叶凌天陈潇染_风起_恋上你看书网
-
2026-03-02 14:43:57
图片素材
成功
标题:小气鬼的作文800字 描写小气鬼的作文 关于小气鬼的作文-作文网
简介:作文网精选关于小气鬼的800字作文,包含小气鬼的作文素材,关于小气鬼的作文题目,以小气鬼为话题的800字作文大全,作文网
-
2026-03-02 16:40:13
综合导航
成功
标题:† Supernodical. World English Historical Dictionary
简介:† Supernodical. World English Historical Dictionary
-
2026-03-02 18:54:21
实用工具
成功
标题:IPV4协议 - 驱动人生-驱动人生
简介:驱动人生是一家专注于电脑驱动管理工具、手机日历软件等相关的互联网PC/手机软件研发公司。
-
2026-03-02 16:50:01
综合导航
成功
标题:Next-gen PSP 5G console video shows the dazzling PS5 peripheral of our dreams T3
简介:We, for one, would be happy if we get a PS5 PlayStation Port
-
2026-03-02 10:06:56
教育培训
成功
标题:精选四年级想象作文集合八篇
简介:在日常生活或是工作学习中,大家都跟作文打过交道吧,借助作文可以宣泄心中的情感,调节自己的心情。那么,怎么去写作文呢?下面
-
2026-03-02 16:29:38
综合导航
成功
标题:Why are Bitcoin miners collectively shifting their focus to AI? The reasons are astonishing. Bee Network
简介:Key points summary Unstable revenue and rising Bitcoin min
-
2026-03-02 14:51:51
综合导航
成功
标题:房屋建筑物明细表-果果圈模板
简介:房屋建筑物明细表,模板记录房屋建筑物位置、面积等相关信息,方便日后查找核对,欢迎大家下载统计。果果圈拥有海量优质模板资源
-
2026-03-02 18:54:56
房产家居
成功
标题:大年初八开工第一天,南宁市一栋5层自建房被拍卖,62万就竞得 南宁市 房地产 拍卖 武鸣区 自建房_手机网易网
简介:开年第一天,南宁市司法拍卖市场上就迎来了一栋房子被拍卖成功了!2月24日,大年初八上班第一天,在阿里拍卖上,南宁市就迎来
-
2026-03-02 16:53:04
综合导航
成功
标题:益生菌到底有用吗,符合这几个标准的益生菌才能买-果果圈模板
简介:提到“益生菌”,相信宝妈们对这个名字并不陌生,宝宝出现便秘或腹泻时,许多妈妈都会给孩子吃益生菌。那么要怎么给孩子挑选益生