@@ -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" );
@@ -1421,7 +1423,7 @@ public Request buildRequest(String path, String method, List<Pair> queryParams,
14211423 */
14221424 public String buildUrl (String path , List <Pair > queryParams ) {
14231425 final StringBuilder url = new StringBuilder ();
1424- url .append (GlobalLabelParameters .URL_PREFIX ).append (merchantConfig .getRequestHost ()).append (path );
1426+ url .append (GlobalLabelParameters .URL_PREFIX ).append (merchantConfig .getRequestHost (). trim () ).append (path );
14251427
14261428 if (queryParams != null && !queryParams .isEmpty ()) {
14271429 // support (constant) query string in `path`, e.g. "/posts?draft=1"
0 commit comments