Browse Source

`from2-array` => `into-stream`

http2
Sindre Sorhus 10 years ago
parent
commit
0ee286b86c
  1. 2
      package.json
  2. 8
      test/test-post.js

2
package.json

@ -54,7 +54,7 @@
"unzip-response": "^1.0.0" "unzip-response": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"from2-array": "0.0.3", "into-stream": "^2.0.0",
"istanbul": "^0.3.13", "istanbul": "^0.3.13",
"pem": "^1.4.4", "pem": "^1.4.4",
"tap": "^1.0.0" "tap": "^1.0.0"

8
test/test-post.js

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var test = require('tap').test; var test = require('tap').test;
var from2Array = require('from2-array'); var intoStream = require('into-stream');
var got = require('../'); var got = require('../');
var server = require('./server.js'); var server = require('./server.js');
var s = server.createServer(); var s = server.createServer();
@ -31,7 +31,7 @@ test('setup', function (t) {
test('GET can have body', function (t) { test('GET can have body', function (t) {
t.plan(3); t.plan(3);
var stream = from2Array(['wow']); var stream = intoStream(['wow']);
stream.on('end', function () { stream.on('end', function () {
// ensure that stream was dumped // ensure that stream was dumped
@ -57,7 +57,7 @@ test('send data from options with post request', function (t) {
t.equal(data, 'wow'); t.equal(data, 'wow');
}); });
got(s.url, {body: from2Array(['wow'])}, function (err, data) { got(s.url, {body: intoStream(['wow'])}, function (err, data) {
t.error(err); t.error(err);
t.equal(data, 'wow'); t.equal(data, 'wow');
}); });
@ -84,7 +84,7 @@ test('post have content-length header to string', function (t) {
t.equal(headers['content-length'], '3'); t.equal(headers['content-length'], '3');
}); });
got(s.url + '/headers', {body: from2Array(['wow']), json: true}, function (err, headers) { got(s.url + '/headers', {body: intoStream(['wow']), json: true}, function (err, headers) {
t.error(err); t.error(err);
t.equal(headers['content-length'], undefined); t.equal(headers['content-length'], undefined);
}); });

Loading…
Cancel
Save