Christian Fraß
[add] server:lib:node_modules
Christian Fraß commited 6e9c872 at 2021-03-08 23:52:07
request_stream_spec.js
var fs = require('fs'),
needle = require('..'),
stream = require('stream'),
http = require('http'),
should = require('should'),
sinon = require('sinon');
var port = 2233;
var node_major_ver = parseInt(process.version.split('.')[0].replace('v', ''));
describe('request stream length', function() {
var server, writable;
function createServer() {
return http.createServer(function(req, res) {
req.on('data', function(chunk) {
// console.log(chunk.length);
})
req.on('end', function() {
res.writeHeader(200, { 'Content-Type': 'application/json'})
res.end(JSON.stringify({ headers: req.headers }))
})
})
}
before(function(done) {
server = createServer();
server.listen(port, done)
})
beforeEach(function() {
writable = new stream.Readable();
writable._read = function() {
this.push('hello world');
this.push(null);
}
})
after(function(done) {
server.close(done)
})
function send_request(opts, cb) {
needle.post('http://localhost:' + port, writable, opts, function(err, resp) {
cb(err, resp)
})
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX