Browse Source

implement got as WritableStream on PATCH too

followup to c080439382
http2
Sindre Sorhus 10 years ago
parent
commit
a1525f8edd
  1. 2
      index.js
  2. 10
      test.js

2
index.js

@ -110,7 +110,7 @@ function got(url, opts, cb) {
return; return;
} }
if (opts.method === 'POST' || opts.method === 'PUT') { if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') {
proxy.setWritable(req); proxy.setWritable(req);
return; return;
} }

10
test.js

@ -174,4 +174,14 @@ describe('POST', function () {
}) })
.end('Hello'); .end('Hello');
}); });
it('should be a writeable stream on PATCH', function (done) {
got.patch('http://0.0.0.0:8081')
.on('error', done)
.on('data', function (chunk) {
assert.equal(chunk, 'Hello');
done();
})
.end('Hello');
});
}); });

Loading…
Cancel
Save