summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-request-large-payload.js
blob: 3be100b740417fa977bf180df0543b18579efee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
require('../common');

// This test ensures Node.js doesn't throw an error when making requests with
// the payload 16kb or more in size.
// https://github.com/nodejs/node/issues/2821

const http = require('http');

const server = http.createServer(function(req, res) {
  res.writeHead(200);
  res.end();

  server.close();
});

server.listen(0, function() {
  const req = http.request({
    method: 'POST',
    port: this.address().port
  });

  const payload = Buffer.alloc(16390, 'Й');
  req.write(payload);
  req.end();
});