Skip to content

Commit ba439b3

Browse files
committed
stress-test:Fix check if the ssl scheme is set in the url
1 parent 02fc91c commit ba439b3

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

packages/neo4j-driver/test/stress-test.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* limitations under the License.
1818
*/
1919

20+
import { internal } from 'neo4j-driver-core'
2021
import neo4j from '../src'
2122
import { READ, WRITE } from '../src/driver'
2223
import parallelLimit from 'async/parallelLimit'
@@ -136,19 +137,9 @@ function isRemoteCluster () {
136137
return fromEnvOrDefault('STRESS_TEST_DATABASE_URI') !== undefined
137138
}
138139

139-
function isSslSchemeNotSet (uri) {
140-
function extractScheme (scheme) {
141-
if (scheme) {
142-
scheme = scheme.trim()
143-
if (scheme.charAt(scheme.length - 1) === ':') {
144-
scheme = scheme.substring(0, scheme.length - 1)
145-
}
146-
return scheme
147-
}
148-
return null
149-
}
150-
const scheme = extractScheme(uri)
151-
return scheme === null || scheme === 'bolt' || scheme === 'neo4j'
140+
function isSslSchemeNotSet (url) {
141+
const parsedUri = internal.urlUtil.parseDatabaseUrl(url)
142+
return parsedUri.scheme === null || parsedUri.scheme === 'bolt' || parsedUri.scheme === 'neo4j'
152143
}
153144

154145
function isCluster () {

0 commit comments

Comments
 (0)