summaryrefslogtreecommitdiff
path: root/node_modules/needle/test/long_string_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/needle/test/long_string_spec.js')
-rw-r--r--node_modules/needle/test/long_string_spec.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/node_modules/needle/test/long_string_spec.js b/node_modules/needle/test/long_string_spec.js
new file mode 100644
index 0000000..4baa4fa
--- /dev/null
+++ b/node_modules/needle/test/long_string_spec.js
@@ -0,0 +1,34 @@
+var needle = require('../'),
+ should = require('should');
+
+describe('when posting a very long string', function() {
+
+ this.timeout(20000);
+
+ function get_string(length) {
+ var str = '';
+ for (var i = 0; i < length; i++) {
+ str += 'x';
+ }
+ return str;
+ }
+
+ it("shouldn't throw an EPIPE error out of nowhere", function(done) {
+ var error;
+
+ function finished() {
+ setTimeout(function() {
+ should.not.exist(error);
+ done();
+ }, 300);
+ }
+
+ try {
+ needle.post('https://google.com', { data: get_string(Math.pow(2, 20)) }, finished)
+ } catch(e) {
+ error = e;
+ }
+
+ })
+
+})