Skip to content

Commit 26f92fb

Browse files
committed
Trim the hostname while creating request url
1 parent 51a7611 commit 26f92fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/Invokers/ApiClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public String getBasePath() {
274274
* @return An instance of OkHttpClient
275275
*/
276276
public ApiClient setBasePath(String basePath) {
277-
this.basePath = this.basePath.concat(merchantConfig.getRequestHost());
277+
this.basePath = this.basePath.concat(merchantConfig.getRequestHost().trim());
278278
return this;
279279
}
280280

@@ -1301,13 +1301,15 @@ public void callAuthenticationHeader(String method, String path, Object body, Li
13011301
authorization.setJWTRequestBody(requestBody);
13021302
merchantConfig.setRequestJsonPath(GlobalLabelParameters.POST_OBJECT_METHOD_REQUEST_PATH);
13031303
boolean isMerchantDetails = merchantConfig.validateMerchantDetails(logger);
1304+
1305+
merchantConfig.setRequestHost(merchantConfig.getRequestHost().trim());
13041306

13051307
if (isMerchantDetails) {
13061308
String token = authorization.getToken(merchantConfig);
13071309
if (merchantConfig.getAuthenticationType().equalsIgnoreCase(GlobalLabelParameters.HTTP)) {
13081310

13091311
addDefaultHeader("Date", PropertiesUtil.date);
1310-
addDefaultHeader("Host", merchantConfig.getRequestHost());
1312+
addDefaultHeader("Host", merchantConfig.getRequestHost().trim());
13111313
addDefaultHeader("v-c-merchant-id", merchantConfig.getMerchantID());
13121314
addDefaultHeader("Signature", token);
13131315
addDefaultHeader("User-Agent", "Mozilla/5.0");

0 commit comments

Comments
 (0)