diff --git a/src/main/java/com/amihaiemil/charles/rest/CharlesResource.java b/src/main/java/com/amihaiemil/charles/rest/CharlesResource.java index 5ce7b7c..a15316c 100644 --- a/src/main/java/com/amihaiemil/charles/rest/CharlesResource.java +++ b/src/main/java/com/amihaiemil/charles/rest/CharlesResource.java @@ -160,7 +160,7 @@ public Response search( SearchResultsPage results = aws.search(query); String queryStringFormat = "?kw=%s&ctg=%s&index=%s&size=%s"; - String requestUrl = servletRequest.getRequestURL().toString(); + String requestUrl = servletRequest.getRequestURL().toString().replace("http://", "https://"); if(idx == 0) { results = results.withPrevPage("-"); } else { diff --git a/src/test/java/com/amihaiemil/charles/rest/CharlesResourceTestCase.java b/src/test/java/com/amihaiemil/charles/rest/CharlesResourceTestCase.java index 462cd73..3cebf5d 100644 --- a/src/test/java/com/amihaiemil/charles/rest/CharlesResourceTestCase.java +++ b/src/test/java/com/amihaiemil/charles/rest/CharlesResourceTestCase.java @@ -90,7 +90,7 @@ public void pagesAreDisplayed() throws IOException { MatcherAssert.assertThat( page.getString("nextPage"), Matchers.equalTo( - "http://example.com?kw=test&ctg=page&index=3&size=3" + "https://example.com?kw=test&ctg=page&index=3&size=3" ) ); MatcherAssert.assertThat( @@ -99,13 +99,13 @@ public void pagesAreDisplayed() throws IOException { MatcherAssert.assertThat( page.getJsonArray("pages").getString(0), Matchers.equalTo( - "http://example.com?kw=test&ctg=page&index=0&size=3" + "https://example.com?kw=test&ctg=page&index=0&size=3" ) ); MatcherAssert.assertThat( page.getJsonArray("pages").getString(8), Matchers.equalTo( - "http://example.com?kw=test&ctg=page&index=24&size=3" + "https://example.com?kw=test&ctg=page&index=24&size=3" ) ); } finally {