Comparing version 4.1.0 to 5.0.0
@@ -27,3 +27,3 @@ "use strict"; | ||
return function logError(label, e) { | ||
var msg = label + " threw exception: "; | ||
var msg = `${label} threw exception: `; | ||
var err = { | ||
@@ -40,3 +40,3 @@ name: e.name || label, | ||
config.logger(msg + "[" + err.name + "] " + err.message); | ||
config.logger(`${msg}[${err.name}] ${err.message}`); | ||
@@ -43,0 +43,0 @@ if (err.stack) { |
@@ -21,9 +21,7 @@ "use strict"; | ||
throw new TypeError( | ||
"Fake server response body should be a string, but was " + | ||
typeof response[2] | ||
`Fake server response body should be a string, but was ${typeof response[2]}` | ||
); | ||
} else if (!(response[2] instanceof ArrayBuffer)) { | ||
throw new TypeError( | ||
"Fake server response body should be a string or ArrayBuffer, but was " + | ||
typeof response[2] | ||
`Fake server response body should be a string or ArrayBuffer, but was ${typeof response[2]}` | ||
); | ||
@@ -44,3 +42,3 @@ } | ||
winloc.hostname + | ||
(String(winloc.port) === "80" ? "" : ":" + winloc.port); | ||
(String(winloc.port) === "80" ? "" : `:${winloc.port}`); | ||
return winloc; | ||
@@ -86,3 +84,3 @@ } | ||
var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host + "/"); | ||
var rCurrLoc = new RegExp(`^${wloc.protocol}//${wloc.host}/`); | ||
@@ -246,3 +244,3 @@ var requestUrl = request.url; | ||
// eslint-disable-next-line no-param-reassign | ||
url = m[1] + "\\:" + m[2]; | ||
url = `${m[1]}\\:${m[2]}`; | ||
} | ||
@@ -249,0 +247,0 @@ |
@@ -7,4 +7,4 @@ "use strict"; | ||
str = "Request:\n" + inspect(request) + "\n\n"; | ||
str += "Response:\n" + inspect(response) + "\n\n"; | ||
str = `Request:\n${inspect(request)}\n\n`; | ||
str += `Response:\n${inspect(response)}\n\n`; | ||
@@ -11,0 +11,0 @@ /* istanbul ignore else: when this.logger is not a function, it can't be called */ |
@@ -74,3 +74,3 @@ "use strict"; | ||
self.addEventListener(eventName, function(event) { | ||
var listener = self["on" + eventName]; | ||
var listener = self[`on${eventName}`]; | ||
@@ -113,5 +113,3 @@ if (listener && typeof listener === "function") { | ||
error = new Error( | ||
"Attempted to respond to fake XMLHttpRequest with " + | ||
body + | ||
", which is not a string or ArrayBuffer." | ||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string or ArrayBuffer.` | ||
); | ||
@@ -122,5 +120,3 @@ error.name = "InvalidBodyException"; | ||
error = new Error( | ||
"Attempted to respond to fake XMLHttpRequest with " + | ||
body + | ||
", which is not a string." | ||
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string.` | ||
); | ||
@@ -331,3 +327,3 @@ error.name = "InvalidBodyException"; | ||
if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { | ||
throw new Error("INVALID_STATE_ERR - " + xhr.readyState); | ||
throw new Error(`INVALID_STATE_ERR - ${xhr.readyState}`); | ||
} | ||
@@ -375,3 +371,3 @@ } | ||
} | ||
throw new Error("Invalid responseType " + responseType); | ||
throw new Error(`Invalid responseType ${responseType}`); | ||
} | ||
@@ -577,4 +573,3 @@ | ||
throw new TypeError( | ||
"By RFC7230, section 3.2.4, header values should be strings. Got " + | ||
typeof value | ||
`By RFC7230, section 3.2.4, header values should be strings. Got ${typeof value}` | ||
); | ||
@@ -596,3 +591,3 @@ } | ||
// eslint-disable-next-line quotes | ||
'Refused to set unsafe header "' + header + '"' | ||
`Refused to set unsafe header "${header}"` | ||
); | ||
@@ -606,3 +601,3 @@ } | ||
if (existingHeader) { | ||
this.requestHeaders[existingHeader] += ", " + value; | ||
this.requestHeaders[existingHeader] += `, ${value}`; | ||
} else { | ||
@@ -649,4 +644,5 @@ this.requestHeaders[header] = value; | ||
var value = this.requestHeaders[contentType].split(";"); | ||
this.requestHeaders[contentType] = | ||
value[0] + ";charset=utf-8"; | ||
this.requestHeaders[ | ||
contentType | ||
] = `${value[0]};charset=utf-8`; | ||
} else if (supportsFormData && !(data instanceof FormData)) { | ||
@@ -756,3 +752,3 @@ this.requestHeaders["Content-Type"] = | ||
return prev + (header + ": " + value + "\r\n"); | ||
return `${prev}${header}: ${value}\r\n`; | ||
}, ""); | ||
@@ -759,0 +755,0 @@ |
{ | ||
"name": "nise", | ||
"version": "4.1.0", | ||
"version": "5.0.0", | ||
"description": "Fake XHR and server", | ||
@@ -48,10 +48,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"@sinonjs/eslint-config": "^4.0.0", | ||
"@sinonjs/referee": "^5.0.0", | ||
"browserify": "^16.2.3", | ||
"eslint": "^6.1.0", | ||
"eslint-config-prettier": "^6.9.0", | ||
"eslint-config-sinon": "^3.0.1", | ||
"eslint-plugin-ie11": "1.0.0", | ||
"eslint-plugin-mocha": "^6.1.1", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"husky": "^4.2.1", | ||
@@ -79,3 +74,3 @@ "jsdom": "^16.2.0", | ||
"*.{js,css,md}": "prettier --check", | ||
"*.js": "eslint" | ||
"*.js": "eslint --quiet" | ||
}, | ||
@@ -82,0 +77,0 @@ "husky": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15
844800
10483
2