Permalink
Browse files

requests are writable, responses are readable

  • Loading branch information...
1 parent 552aa01 commit e348b6e52ef5da7a3376476b1a03fbe5bd09c205 @substack committed Oct 13, 2012
Showing with 4 additions and 2 deletions.
  1. +3 −2 lib/request.js
  2. +1 −0 lib/response.js
View
@@ -1,9 +1,10 @@
-var EventEmitter = require('events').EventEmitter;
+var Stream = require('stream');
var Response = require('./response');
var concatStream = require('concat-stream')
var Request = module.exports = function (xhr, params) {
var self = this;
+ self.writable = true;
self.xhr = xhr;
self.body = concatStream()
@@ -38,7 +39,7 @@ var Request = module.exports = function (xhr, params) {
};
};
-Request.prototype = new EventEmitter;
+Request.prototype = new Stream;
Request.prototype.setHeader = function (key, value) {
if ((Array.isArray && Array.isArray(value))
View
@@ -2,6 +2,7 @@ var Stream = require('stream');
var Response = module.exports = function (res) {
this.offset = 0;
+ this.readable = true;
};
Response.prototype = new Stream;

0 comments on commit e348b6e

Please sign in to comment.