[Pkg-javascript-commits] [node-stream-http] 77/208: Add test for data in `request.end()`

Bastien Roucariès rouca at moszumanska.debian.org
Sun Aug 13 13:39:30 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-stream-http.

commit 1a4a89a5e4d786a0238fa8f6f7373fe4cf834ad9
Author: John Hiesey <john at hiesey.com>
Date:   Fri Aug 7 18:02:33 2015 -0700

    Add test for data in `request.end()`
---
 test/browser/post-text.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/browser/post-text.js b/test/browser/post-text.js
index 92bdcd2..1cea8d7 100644
--- a/test/browser/post-text.js
+++ b/test/browser/post-text.js
@@ -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)
 })
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git



More information about the Pkg-javascript-commits mailing list