@@ -426,12 +426,6 @@ void apiClient_invoke(apiClient_t *apiClient,
426426 operationParameter ,
427427 queryParameters );
428428
429- if (apiClient -> curlConfig -> keepalive == 1 ) {
430- curl_easy_setopt (handle , CURLOPT_TCP_KEEPALIVE , 1L );
431- curl_easy_setopt (handle , CURLOPT_TCP_KEEPIDLE , apiClient -> curlConfig -> keepidle );
432- curl_easy_setopt (handle , CURLOPT_TCP_KEEPINTVL , apiClient -> curlConfig -> keepintvl );
433- }
434-
435429 curl_easy_setopt (handle , CURLOPT_URL , targetUrl );
436430 curl_easy_setopt (handle ,
437431 CURLOPT_WRITEFUNCTION ,
@@ -440,7 +434,6 @@ void apiClient_invoke(apiClient_t *apiClient,
440434 CURLOPT_WRITEDATA ,
441435 apiClient );
442436 curl_easy_setopt (handle , CURLOPT_HTTPHEADER , headers );
443- curl_easy_setopt (handle , CURLOPT_VERBOSE , apiClient -> curlConfig -> verbose );
444437
445438 // this would only be generated for OAuth2 authentication
446439 if (apiClient -> accessToken != NULL ) {
@@ -454,6 +447,15 @@ void apiClient_invoke(apiClient_t *apiClient,
454447 postData (handle , bodyParameters , bodyParametersLength );
455448 }
456449
450+ if (apiClient -> curlConfig != NULL ) {
451+ if (apiClient -> curlConfig -> keepalive == 1 ) {
452+ curl_easy_setopt (handle , CURLOPT_TCP_KEEPALIVE , 1L );
453+ curl_easy_setopt (handle , CURLOPT_TCP_KEEPIDLE , apiClient -> curlConfig -> keepidle );
454+ curl_easy_setopt (handle , CURLOPT_TCP_KEEPINTVL , apiClient -> curlConfig -> keepintvl );
455+ }
456+ curl_easy_setopt (handle , CURLOPT_VERBOSE , apiClient -> curlConfig -> verbose );
457+ }
458+
457459 res = curl_easy_perform (handle );
458460
459461 curl_slist_free_all (headers );
0 commit comments