Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Explicitly pass radix 10 to parseInt functions in toBeLevelxxx() to avoid unexpected results

Karel De Smetea227e09fa6a
diff --git a/helpers/postwomanTesting.js b/helpers/postwomanTesting.js
index 1de644e94..3bf8fcf49 100644
--- a/helpers/postwomanTesting.js
+++ b/helpers/postwomanTesting.js
@@ -109,7 +109,7 @@ class Expectation {
)
}
toBeLevel2xx() {
- const code = parseInt(this.expectValue)
+ const code = parseInt(this.expectValue, 10)
if (Number.isNaN(code)) {
return this._fail(`Expected 200-level status but could not parse value ${this.expectValue}`)
}
@@ -118,7 +118,7 @@ class Expectation {
: this._fail(this._fmtNot(`Expected ${this.expectValue} to (not)be 200-level status`))
}
toBeLevel3xx() {
- const code = parseInt(this.expectValue)
+ const code = parseInt(this.expectValue, 10)
if (Number.isNaN(code)) {
return this._fail(`Expected 300-level status but could not parse value ${this.expectValue}`)
}
@@ -127,7 +127,7 @@ class Expectation {
: this._fail(this._fmtNot(`Expected ${this.expectValue} to (not)be 300-level status`))
}
toBeLevel4xx() {
- const code = parseInt(this.expectValue)
+ const code = parseInt(this.expectValue, 10)
if (Number.isNaN(code)) {
return this._fail(`Expected 400-level status but could not parse value ${this.expectValue}`)
}
@@ -136,7 +136,7 @@ class Expectation {
: this._fail(this._fmtNot(`Expected ${this.expectValue} to (not)be 400-level status`))
}
toBeLevel5xx() {
- const code = parseInt(this.expectValue)
+ const code = parseInt(this.expectValue, 10)
if (Number.isNaN(code)) {
return this._fail(`Expected 500-level status but could not parse value ${this.expectValue}`)
}