From d617fa8e0b266308f497b13e9087295629e850e8 Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Wed, 9 Oct 2024 15:19:46 +0200 Subject: [PATCH] Support no hostname --- .../java/org/jvnet/hudson/test/RealJenkinsRule.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java b/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java index 45be47526..828c8ff2b 100644 --- a/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java +++ b/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java @@ -755,6 +755,18 @@ public URL getUrl() throws MalformedURLException { return new URL(https ? "https" : "http", host, port, "/jenkins/"); } + /** + * Sets up HTTPS for the current instance, and disables plain HTTP. + * This generates a self-signed certificate for localhost. The corresponding root CA that needs to be trusted by HTTP client can be obtained using {@link #getRootCA()}. + * + * @return the current instance + * @see #createWebClient() + */ + public RealJenkinsRule https() { + return https("localhost"); + } + + /** * Sets up HTTPS for the current instance, and disables plain HTTP. * This generates a self-signed certificate for the given host name. The corresponding root CA that needs to be trusted by HTTP client can be obtained using {@link #getRootCA()}.