aboutsummaryrefslogtreecommitdiff
path: root/node_modules/superagent/lib/node/response.js
diff options
context:
space:
mode:
authorAlee14 <Alee14498@gmail.com>2017-07-28 16:20:27 -0400
committerAlee14 <Alee14498@gmail.com>2017-07-28 16:20:27 -0400
commitd35e0862e6b60fe3c4f823371627359f3ce3e68b (patch)
treed98b788eb1abf0a8814207b993b4e22efe711deb /node_modules/superagent/lib/node/response.js
parent20993df62e7e38ed43428aafa5981afc3543bdea (diff)
downloadAleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.tar.gz
AleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.tar.bz2
AleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.zip
Removing node modules (go get them yourself :P)
Diffstat (limited to 'node_modules/superagent/lib/node/response.js')
-rw-r--r--node_modules/superagent/lib/node/response.js123
1 files changed, 0 insertions, 123 deletions
diff --git a/node_modules/superagent/lib/node/response.js b/node_modules/superagent/lib/node/response.js
deleted file mode 100644
index 9a9ea15..0000000
--- a/node_modules/superagent/lib/node/response.js
+++ /dev/null
@@ -1,123 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var util = require('util');
-var Stream = require('stream');
-var ResponseBase = require('../response-base');
-
-/**
- * Expose `Response`.
- */
-
-module.exports = Response;
-
-/**
- * Initialize a new `Response` with the given `xhr`.
- *
- * - set flags (.ok, .error, etc)
- * - parse header
- *
- * @param {Request} req
- * @param {Object} options
- * @constructor
- * @extends {Stream}
- * @implements {ReadableStream}
- * @api private
- */
-
-function Response(req) {
- Stream.call(this);
- var res = this.res = req.res;
- this.request = req;
- this.req = req.req;
- this.text = res.text;
- this.body = res.body !== undefined ? res.body : {};
- this.files = res.files || {};
- this.buffered = 'string' == typeof this.text;
- this.header = this.headers = res.headers;
- this._setStatusProperties(res.statusCode);
- this._setHeaderProperties(this.header);
- this.setEncoding = res.setEncoding.bind(res);
- res.on('data', this.emit.bind(this, 'data'));
- res.on('end', this.emit.bind(this, 'end'));
- res.on('close', this.emit.bind(this, 'close'));
- res.on('error', this.emit.bind(this, 'error'));
-}
-
-/**
- * Inherit from `Stream`.
- */
-
-util.inherits(Response, Stream);
-ResponseBase(Response.prototype);
-
-
-/**
- * Implements methods of a `ReadableStream`
- */
-
-Response.prototype.destroy = function(err){
- this.res.destroy(err);
-};
-
-/**
- * Pause.
- */
-
-Response.prototype.pause = function(){
- this.res.pause();
-};
-
-/**
- * Resume.
- */
-
-Response.prototype.resume = function(){
- this.res.resume();
-};
-
-/**
- * Return an `Error` representative of this response.
- *
- * @return {Error}
- * @api public
- */
-
-Response.prototype.toError = function(){
- var req = this.req;
- var method = req.method;
- var path = req.path;
-
- var msg = 'cannot ' + method + ' ' + path + ' (' + this.status + ')';
- var err = new Error(msg);
- err.status = this.status;
- err.text = this.text;
- err.method = method;
- err.path = path;
-
- return err;
-};
-
-
-Response.prototype.setStatusProperties = function(status){
- console.warn("In superagent 2.x setStatusProperties is a private method");
- return this._setStatusProperties(status);
-};
-
-/**
- * To json.
- *
- * @return {Object}
- * @api public
- */
-
-Response.prototype.toJSON = function(){
- return {
- req: this.request.toJSON(),
- header: this.header,
- status: this.status,
- text: this.text
- };
-};