Skip to content

Commit 73e8a4c

Browse files
committed
[minor] Added missing JSDoc comments
1 parent 3ab6e95 commit 73e8a4c

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

lib/http-proxy/common.js

+24-5
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,36 @@ common.setupSocket = function(socket) {
102102
return socket;
103103
};
104104

105+
/**
106+
* Get the port number from the host. Or guess it based on the connection type.
107+
*
108+
* @param {Request} req Incoming HTTP request.
109+
*
110+
* @return {String} The port number.
111+
*
112+
* @api private
113+
*/
105114
common.getPort = function(req) {
106-
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : "";
115+
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : '';
116+
107117
return res ?
108118
res[1] :
109-
req.connection.pair ? '443' : '80' ;
119+
req.connection.pair ? '443' : '80';
110120
};
111121

112-
// OS-agnostic join (doesn't break on URLs like path.join does on Windows)
122+
/**
123+
* OS-agnostic join (doesn't break on URLs like path.join does on Windows)>
124+
*
125+
* @return {String} The generated path.
126+
*
127+
* @api private
128+
*/
129+
113130
common.urlJoin = function() {
114131
var args = Array.prototype.slice.call(arguments);
115-
// Join all strings, but remove empty strings so we don't get extra slashes from
132+
// Join all strings, but remove empty strings so we don't get extra slashes from
116133
// joining e.g. ['', 'am']
117-
return args.filter(function(a) { return !!a; }).join('/').replace(/\/+/g, '/');
134+
return args.filter(function filter(a) {
135+
return !!a;
136+
}).join('/').replace(/\/+/g, '/');
118137
};

0 commit comments

Comments
 (0)