@Override
    public URL getURL(HttpRequest request) {
        var externalUrl = haloProperties.getExternalUrl();
        if (externalUrl == null) {
            try {
                externalUrl = request.getURI().resolve(getBasePath()).toURL();
            } catch (MalformedURLException e) {
                throw new RuntimeException("Cannot parse request URI to URL.", e);
            }
        }
        return externalUrl;
    }
@Test
    void getURLWhenExternalURLAbsent() throws MalformedURLException {
        var fakeUri = URI.create("https://localhost/fake");
        when(haloProperties.getExternalUrl()).thenReturn(null);
        var mockRequest = mock(HttpRequest.class);
        when(mockRequest.getURI()).thenReturn(fakeUri);
        var url = externalUrl.getURL(mockRequest);
        assertEquals(new URL("https://localhost/"), url);
    }