@@ -1271,6 +1271,13 @@ const server = http.createServer((req, res) => { |
1271 | 1271 | }); |
1272 | 1272 | ``` |
1273 | 1273 |
|
| 1274 | +If [`response.writeHead()`][] method is called and this method has not been |
| 1275 | +called, it will directly write the supplied header values onto the network |
| 1276 | +channel without caching internally, and the [`response.getHeader()`][] on the |
| 1277 | +header will not yield the expected result. If progressive population of headers |
| 1278 | +is desired with potential future retrieval and modification, use |
| 1279 | +[`response.setHeader()`][] instead of [`response.writeHead()`][]. |
| 1280 | + |
1274 | 1281 | ### response.setTimeout(msecs[, callback]) |
1275 | 1282 | <!-- YAML |
1276 | 1283 | added: v0.9.12 |
@@ -1438,6 +1445,13 @@ When headers have been set with [`response.setHeader()`][], they will be merged |
1438 | 1445 | with any headers passed to [`response.writeHead()`][], with the headers passed |
1439 | 1446 | to [`response.writeHead()`][] given precedence. |
1440 | 1447 |
|
| 1448 | +If this method is called and [`response.setHeader()`][] has not been called, |
| 1449 | +it will directly write the supplied header values onto the network channel |
| 1450 | +without caching internally, and the [`response.getHeader()`][] on the header |
| 1451 | +will not yield the expected result. If progressive population of headers is |
| 1452 | +desired with potential future retrieval and modification, use |
| 1453 | +[`response.setHeader()`][] instead. |
| 1454 | + |
1441 | 1455 | ```js |
1442 | 1456 | // returns content-type = text/plain |
1443 | 1457 | const server = http.createServer((req, res) => { |
|