1717 */
1818class Client
1919{
20+ static protected $ UserAgent = 'Seti \'s JiraApi Rest Client v1.5.* ' ;
21+
2022 static protected $ isJIRAUtf8 = true ;
2123
2224 static protected $ jMapper = null ;
@@ -191,6 +193,7 @@ public function exec($context, $post_data = null, $custom_request = null, $tries
191193 curl_setopt ($ ch , CURLOPT_SSL_VERIFYHOST , $ this ->getConfiguration ()->isCurlOptSslVerifyHost ());
192194 curl_setopt ($ ch , CURLOPT_SSL_VERIFYPEER , $ this ->getConfiguration ()->isCurlOptSslVerifyPeer ());
193195 curl_setopt ($ ch , CURLOPT_FOLLOWLOCATION , true );
196+ curl_setopt ($ ch , CURLOPT_USERAGENT , self ::$ UserAgent . ($ this ->getConfiguration ()->getUserAgent () ? ' [] ' : '' ));
194197 curl_setopt ($ ch , CURLOPT_HTTPHEADER ,
195198 array ('Accept: */* ' , 'Content-Type: application/json ' ));
196199 curl_setopt ($ ch , CURLOPT_VERBOSE , $ this ->getConfiguration ()->isCurlOptVerbose ());
@@ -208,7 +211,7 @@ public function exec($context, $post_data = null, $custom_request = null, $tries
208211 $ url .= '&startAt= ' .$ post_data ->startAt ;
209212 $ url .= '&maxResults= ' .$ post_data ->maxResults ;
210213 $ url .= '&expand= ' .$ post_data ->expand ;
211- if (isset ($ post_data ->fields ) && !empty ($ post_data ->fields )) $ url .= '&fields= ' .$ post_data -> fields ;
214+ if (isset ($ post_data ->fields ) && !empty ($ post_data ->fields )) $ url .= '&fields= ' .( is_array ( $ post_data -> fields ) ? implode ( ' , ' , $ post_data -> fields ) : $ post_data -> fields ) ;
212215 $ post_data = null ;
213216 curl_setopt ($ ch , CURLOPT_POST , false );
214217 curl_setopt ($ ch , CURLOPT_URL , $ url );
0 commit comments