@@ -53,7 +53,7 @@ public function get($endpointUri, $queryString = [])
5353 */
5454 public function post ($ endpointUri , $ data = [])
5555 {
56- return $ this ->send ('POST ' , $ endpointUri , http_build_query ( $ data) );
56+ return $ this ->send ('POST ' , $ endpointUri , $ data );
5757 }
5858
5959 /**
@@ -65,7 +65,7 @@ public function post($endpointUri, $data = [])
6565 */
6666 public function put ($ endpointUri , $ putData = [])
6767 {
68- return $ this ->send ('PUT ' , $ endpointUri , http_build_query ( $ putData) );
68+ return $ this ->send ('PUT ' , $ endpointUri , $ putData );
6969 }
7070
7171 /**
@@ -93,7 +93,7 @@ protected function send($method, $endpointUri, $body = null, array $headers = []
9393 $ headers = array_merge ($ headers , self ::getDefaultHeaders ());
9494 $ endpointUrl = $ this ->baseUrl . $ endpointUri ;
9595
96- $ request = new Request ($ method , $ endpointUrl , $ headers , $ body );
96+ $ request = new Request ($ method , $ endpointUrl , $ headers , json_encode ( $ body) );
9797 $ response = $ this ->getHttpClient ()->sendRequest ($ request );
9898
9999 return $ this ->handleResponse ($ response );
@@ -139,7 +139,8 @@ protected function getHttpClient()
139139 protected function getDefaultHeaders () {
140140 return [
141141 'User-Agent ' => ApiConstants::SDK_USER_AGENT . '/ ' . ApiConstants::SDK_VERSION ,
142- 'X-MailerLite-ApiKey ' => $ this ->apiKey
142+ 'X-MailerLite-ApiKey ' => $ this ->apiKey ,
143+ 'Content-Type ' => 'application/json '
143144 ];
144145 }
145146}
0 commit comments