2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-23 20:40:40 +03:00

style: fix word spelling ang lint style in comment (#4500)

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Jingyi Lin
2022-05-04 03:12:16 +08:00
committed by GitHub
parent 3479ca7c76
commit ba85e0e385
2 changed files with 15 additions and 15 deletions
+3 -3
View File
@@ -276,7 +276,7 @@ module.exports = function httpAdapter(config) {
case 'gzip': case 'gzip':
case 'compress': case 'compress':
case 'deflate': case 'deflate':
// add the unzipper to the body stream processing pipeline // add the unzipper to the body stream processing pipeline
stream = stream.pipe(zlib.createUnzip()); stream = stream.pipe(zlib.createUnzip());
// remove the content-encoding in order to not confuse downstream operations // remove the content-encoding in order to not confuse downstream operations
@@ -305,7 +305,7 @@ module.exports = function httpAdapter(config) {
// make sure the content length is not over the maxContentLength if specified // make sure the content length is not over the maxContentLength if specified
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
// stream.destoy() emit aborted event before calling reject() on Node.js v16 // stream.destroy() emit aborted event before calling reject() on Node.js v16
rejected = true; rejected = true;
stream.destroy(); stream.destroy();
reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
@@ -381,7 +381,7 @@ module.exports = function httpAdapter(config) {
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
// And then these socket which be hang up will devoring CPU little by little. // And then these socket which be hang up will devouring CPU little by little.
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
req.setTimeout(timeout, function handleRequestTimeout() { req.setTimeout(timeout, function handleRequestTimeout() {
req.abort(); req.abort();
+12 -12
View File
@@ -13,16 +13,16 @@ module.exports = (
var originURL; var originURL;
/** /**
* Parse a URL to discover it's components * Parse a URL to discover it's components
* *
* @param {String} url The URL to be parsed * @param {String} url The URL to be parsed
* @returns {Object} * @returns {Object}
*/ */
function resolveURL(url) { function resolveURL(url) {
var href = url; var href = url;
if (msie) { if (msie) {
// IE needs attribute set twice to normalize properties // IE needs attribute set twice to normalize properties
urlParsingNode.setAttribute('href', href); urlParsingNode.setAttribute('href', href);
href = urlParsingNode.href; href = urlParsingNode.href;
} }
@@ -47,11 +47,11 @@ module.exports = (
originURL = resolveURL(window.location.href); originURL = resolveURL(window.location.href);
/** /**
* Determine if a URL shares the same origin as the current location * Determine if a URL shares the same origin as the current location
* *
* @param {String} requestURL The URL to test * @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise false * @returns {boolean} True if URL shares the same origin, otherwise false
*/ */
return function isURLSameOrigin(requestURL) { return function isURLSameOrigin(requestURL) {
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol && return (parsed.protocol === originURL.protocol &&
@@ -59,7 +59,7 @@ module.exports = (
}; };
})() : })() :
// Non standard browser envs (web workers, react-native) lack needed support. // Non standard browser envs (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() { (function nonStandardBrowserEnv() {
return function isURLSameOrigin() { return function isURLSameOrigin() {
return true; return true;