@@ -225,7 +225,11 @@ public function __call($name, $arguments)
225
225
226
226
$ url = $ this ->generateUrl ($ urlParams , $ customAction );
227
227
228
- return $ this ->$ httpMethod ($ dataArray , $ url );
228
+ if ($ httpMethod == 'post ' || $ httpMethod == 'put ' ) {
229
+ return $ this ->$ httpMethod ($ dataArray , $ url , false );
230
+ } else {
231
+ return $ this ->$ httpMethod ($ dataArray , $ url );
232
+ }
229
233
}
230
234
}
231
235
@@ -357,16 +361,17 @@ public function search($query)
357
361
*
358
362
* @param array $dataArray Check Shopify API reference of the specific resource for the list of required and optional data elements to be provided
359
363
* @param string $url
364
+ * @param bool $wrapData
360
365
*
361
366
* @uses HttpRequestJson::post() to send the HTTP request
362
367
*
363
368
* @return array
364
369
*/
365
- public function post ($ dataArray , $ url = null )
370
+ public function post ($ dataArray , $ url = null , $ wrapData = true )
366
371
{
367
372
if (!$ url ) $ url = $ this ->generateUrl ();
368
373
369
- if (!empty ($ dataArray )) $ dataArray = $ this ->wrapData ($ dataArray );
374
+ if ($ wrapData && !empty ($ dataArray )) $ dataArray = $ this ->wrapData ($ dataArray );
370
375
371
376
$ response = HttpRequestJson::post ($ url , $ dataArray , $ this ->httpHeaders );
372
377
@@ -378,17 +383,18 @@ public function post($dataArray, $url = null)
378
383
*
379
384
* @param array $dataArray Check Shopify API reference of the specific resource for the list of required and optional data elements to be provided
380
385
* @param string $url
386
+ * @param bool $wrapData
381
387
*
382
388
* @uses HttpRequestJson::put() to send the HTTP request
383
389
*
384
390
* @return array
385
391
*/
386
- public function put ($ dataArray , $ url = null )
392
+ public function put ($ dataArray , $ url = null , $ wrapData = true )
387
393
{
388
394
389
395
if (!$ url ) $ url = $ this ->generateUrl ();
390
396
391
- if (!empty ($ dataArray )) $ dataArray = $ this ->wrapData ($ dataArray );
397
+ if ($ wrapData && !empty ($ dataArray )) $ dataArray = $ this ->wrapData ($ dataArray );
392
398
393
399
$ response = HttpRequestJson::put ($ url , $ dataArray , $ this ->httpHeaders );
394
400
0 commit comments