Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: name anonymous functions in _http_client #9058

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/_http_incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ util.inherits(IncomingMessage, Stream.Readable);
exports.IncomingMessage = IncomingMessage;


IncomingMessage.prototype.setTimeout = function(msecs, callback) {
IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
if (callback)
this.on('timeout', callback);
this.socket.setTimeout(msecs);
return this;
};


IncomingMessage.prototype.read = function(n) {
IncomingMessage.prototype.read = function read(n) {
if (!this._consuming)
this._readableState.readingMore = false;
this._consuming = true;
Expand All @@ -82,7 +82,7 @@ IncomingMessage.prototype.read = function(n) {
};


IncomingMessage.prototype._read = function(n) {
IncomingMessage.prototype._read = function _read(n) {
// We actually do almost nothing here, because the parserOnBody
// function fills up our internal buffer directly. However, we
// do need to unpause the underlying socket so that it flows.
Expand All @@ -94,13 +94,13 @@ IncomingMessage.prototype._read = function(n) {
// It's possible that the socket will be destroyed, and removed from
// any messages, before ever calling this. In that case, just skip
// it, since something else is destroying this connection anyway.
IncomingMessage.prototype.destroy = function(error) {
IncomingMessage.prototype.destroy = function destroy(error) {
if (this.socket)
this.socket.destroy(error);
};


IncomingMessage.prototype._addHeaderLines = function(headers, n) {
IncomingMessage.prototype._addHeaderLines = function _addHeaderLines(headers, n) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure the lines don't exceed 80 characters. make jslint should help you spot the long lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a silly question, but I want to keep the style, should I do

IncomingMessage.prototype._addHeaderLines =
    function _addHeaderLines(headers, n) {...};

or

function _addHeaderLines(headers, n) {...}
IncomingMessage.prototype._addHeaderLines = _addHeaderLines;

if (headers && headers.length) {
var raw, dest;
if (this.complete) {
Expand Down Expand Up @@ -129,7 +129,7 @@ IncomingMessage.prototype._addHeaderLines = function(headers, n) {
// multiple values this way. If not, we declare the first instance the winner
// and drop the second. Extended header fields (those beginning with 'x-') are
// always joined.
IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
IncomingMessage.prototype._addHeaderLine = function _addHeaderLine(field, value, dest) {
field = field.toLowerCase();
switch (field) {
// Array headers:
Expand Down Expand Up @@ -181,7 +181,7 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {

// Call this instead of resume() if we want to just
// dump all the data to /dev/null
IncomingMessage.prototype._dump = function() {
IncomingMessage.prototype._dump = function _dump() {
if (!this._dumped) {
this._dumped = true;
this.resume();
Expand Down