GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Revert "http: headers(Distinct), trailers(Distinct) setters to be no-op" · nodejs/node@eac26c0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _http_incoming.js
  • test/parallel
    • test-http-set-headers-distinct.js
    • test-set-incoming-message-header.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/_http_incoming.js‎

Copy file name to clipboardExpand all lines: lib/_http_incoming.js
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headers', {
122122
}
123123
return this[kHeaders];
124124
},
125-
set: function(val) {}
125+
set: function(val) {
126+
this[kHeaders] = val;
127+
}
126128
});
127129

128130
ObjectDefineProperty(IncomingMessage.prototype, 'headersDistinct', {
@@ -140,7 +142,9 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headersDistinct', {
140142
}
141143
return this[kHeadersDistinct];
142144
},
143-
set: function(val) {}
145+
set: function(val) {
146+
this[kHeadersDistinct] = val;
147+
}
144148
});
145149

146150
ObjectDefineProperty(IncomingMessage.prototype, 'trailers', {
@@ -158,7 +162,9 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailers', {
158162
}
159163
return this[kTrailers];
160164
},
161-
set: function(val) {}
165+
set: function(val) {
166+
this[kTrailers] = val;
167+
}
162168
});
163169

164170
ObjectDefineProperty(IncomingMessage.prototype, 'trailersDistinct', {
@@ -176,7 +182,9 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailersDistinct', {
176182
}
177183
return this[kTrailersDistinct];
178184
},
179-
set: function(val) {}
185+
set: function(val) {
186+
this[kTrailersDistinct] = val;
187+
}
180188
});
181189

182190
IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
Collapse file

‎test/parallel/test-http-set-headers-distinct.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-set-headers-distinct.js
-54Lines changed: 0 additions & 54 deletions
This file was deleted.
Collapse file

‎test/parallel/test-set-incoming-message-header.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-set-incoming-message-header.js
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ require('../common');
44
const { IncomingMessage } = require('http');
55
const assert = require('assert');
66

7-
// Headers setter should be a No-Op
7+
// Headers setter function set a header correctly
88
{
99
const im = new IncomingMessage();
1010
im.headers = { key: 'value' };
11-
assert.deepStrictEqual(im.headers, {});
11+
assert.deepStrictEqual(im.headers, { key: 'value' });
1212
}
1313

14-
// Trailers setter should be a No-Op
14+
// Trailers setter function set a header correctly
1515
{
1616
const im = new IncomingMessage();
1717
im.trailers = { key: 'value' };
18-
assert.deepStrictEqual(im.trailers, {});
18+
assert.deepStrictEqual(im.trailers, { key: 'value' });
1919
}
2020

2121
// _addHeaderLines function set a header correctly
2222
{
2323
const im = new IncomingMessage();
24+
im.headers = { key1: 'value1' };
2425
im._addHeaderLines(['key2', 'value2'], 2);
25-
assert.deepStrictEqual(im.headers, { key2: 'value2' });
26+
assert.deepStrictEqual(im.headers, { key1: 'value1', key2: 'value2' });
2627
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.