Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d17b406a9 | |||
| 1a4a89a5e4 | |||
| 838aaffac7 | |||
| f70ac39bf4 | |||
| ed525a4a2d | |||
| b162e21d92 |
@@ -45,8 +45,30 @@ http.Agent.defaultMaxSockets = 4
|
||||
http.STATUS_CODES = statusCodes
|
||||
|
||||
http.METHODS = [
|
||||
'CHECKOUT',
|
||||
'CONNECT',
|
||||
'COPY',
|
||||
'DELETE',
|
||||
'GET',
|
||||
'HEAD',
|
||||
'LOCK',
|
||||
'M-SEARCH',
|
||||
'MERGE',
|
||||
'MKACTIVITY',
|
||||
'MKCOL',
|
||||
'MOVE',
|
||||
'NOTIFY',
|
||||
'OPTIONS',
|
||||
'PATCH',
|
||||
'POST',
|
||||
'PROPFIND',
|
||||
'PROPPATCH',
|
||||
'PURGE',
|
||||
'PUT',
|
||||
'DELETE' // TODO: include the methods from RFC 2616 and 2518?
|
||||
]
|
||||
'REPORT',
|
||||
'SEARCH',
|
||||
'SUBSCRIBE',
|
||||
'TRACE',
|
||||
'UNLOCK',
|
||||
'UNSUBSCRIBE'
|
||||
]
|
||||
+1
-4
@@ -244,10 +244,7 @@ ClientRequest.prototype.end = function (data, encoding, cb) {
|
||||
data = undefined
|
||||
}
|
||||
|
||||
if (data)
|
||||
stream.Writable.push.call(self, data, encoding)
|
||||
|
||||
stream.Writable.prototype.end.call(self, cb)
|
||||
stream.Writable.prototype.end.call(self, data, encoding, cb)
|
||||
}
|
||||
|
||||
ClientRequest.prototype.flushHeaders = function () {}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "stream-http",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.1",
|
||||
"description": "Streaming http in the browser",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -25,4 +25,24 @@ test('post text', function (t) {
|
||||
|
||||
req.write(reference)
|
||||
req.end()
|
||||
})
|
||||
|
||||
test('post text with data in end()', function (t) {
|
||||
var req = http.request({
|
||||
path: '/echo',
|
||||
method: 'POST'
|
||||
}, function (res) {
|
||||
var buffers = []
|
||||
|
||||
res.on('end', function () {
|
||||
t.ok(reference.equals(Buffer.concat(buffers)), 'echoed contents match')
|
||||
t.end()
|
||||
})
|
||||
|
||||
res.on('data', function (data) {
|
||||
buffers.push(data)
|
||||
})
|
||||
})
|
||||
|
||||
req.end(reference)
|
||||
})
|
||||
Reference in New Issue
Block a user