File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -355,6 +355,29 @@ public static String makeRelativeUrl(String url)
355355 return StringUtils .stripStart (url , "/" );
356356 }
357357
358+ /**
359+ * Append the test server's base URL to the front of a relative URL. Absolute URLs will be returned unchanged.
360+ * @param url Absolute or relative URL
361+ * @return Absolute URL
362+ */
363+ public static String makeAbsoluteUrl (String url )
364+ {
365+ if (isAbsoluteUrl (url ))
366+ {
367+ return url ;
368+ }
369+ else
370+ {
371+ StringBuilder sb = new StringBuilder (getBaseURL ());
372+ if (!url .startsWith ("/" ))
373+ {
374+ sb .append ("/" );
375+ }
376+ sb .append (url );
377+ return sb .toString ();
378+ }
379+ }
380+
358381 public static boolean isAbsoluteUrl (String url )
359382 {
360383 return url .startsWith ("http://" ) || url .startsWith ("https://" );
Original file line number Diff line number Diff line change @@ -1190,7 +1190,7 @@ else if (urlToCheck.isFromForm()) // Forms may 404 with bad input
11901190
11911191 private boolean doesUrlExist (UrlToCheck urlToCheck )
11921192 {
1193- final String url = stripQueryParams (urlToCheck .getRelativeURL ());
1193+ final String url = WebTestHelper . makeAbsoluteUrl ( stripQueryParams (urlToCheck .getRelativeURL () ));
11941194
11951195 // Check whether 404 was due to a missing action
11961196 HttpContext context = WebTestHelper .getBasicHttpContext ();
You can’t perform that action at this time.
0 commit comments