Skip to content

Commit a8e3a30

Browse files
committed
Run tests with HTTPS on all browsers if the cert is system trusted
1 parent 5853efd commit a8e3a30

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/tech/httptoolkit/android/MainActivity.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,17 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
411411
// the default browser, and only returns null if no known supported browser is installed.
412412
val testBrowserPackage = getTestBrowserPackage(this)
413413

414+
val certIsSystemTrusted = whereIsCertTrusted(
415+
this.currentProxyConfig!! // Safe!! because you can only run tests while connected
416+
) == "system"
417+
414418
val browserIntent = Intent(
415419
Intent.ACTION_VIEW,
416420
Uri.parse(
417421
(
418422
// We test with just plain HTTP if there's no user-cert-trusting browser
419423
// installed, to reduce confusing failures.
420-
if (testBrowserPackage == null) "http" else "https"
424+
if (testBrowserPackage == null && !certIsSystemTrusted) "http" else "https"
421425
) + "://amiusing.httptoolkit.tech"
422426
)
423427
).apply {

0 commit comments

Comments
 (0)