Skip to content

Commit a265f27

Browse files
committed
Fixed a few errant double-slashes in calls to get/post/put/delete functions ( follow-up review of #8 ).
Fixed putNotificationTrackOpen to correctly push data into the 'json' key in the headers array ( #7 ).
1 parent b0b2c9e commit a265f27

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/OneSignalClient.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public function postNotification($data = [], $app_id = '')
242242
$headers[ 'json' ] = $clean_data;
243243

244244
// Return the Response from the OneSignal API
245-
return $this->post("/notifications", $headers);
245+
return $this->post("notifications", $headers);
246246
}
247247

248248
/**
@@ -255,12 +255,12 @@ public function postNotification($data = [], $app_id = '')
255255
*/
256256
public function putNotificationTrackOpen($id, $app_id = '', $opened = true)
257257
{
258-
$headers = $this->headerInit();
258+
$headers = $this->headerInit(false,true);
259259
if ($app_id == '') {
260260
$app_id = $this->appId;
261261
}
262-
$headers[ 'app_id' ] = $app_id;
263-
$headers[ 'opened' ] = $opened;
262+
$headers[ 'json' ][ 'app_id' ] = $app_id;
263+
$headers[ 'json' ][ 'opened' ] = $opened;
264264

265265
return $this->put("notifications/${id}", $headers);
266266
}
@@ -274,7 +274,7 @@ public function putNotificationTrackOpen($id, $app_id = '', $opened = true)
274274
*/
275275
public function deleteNotification($id, $app_id = '')
276276
{
277-
$headers = $this->headerInit(false, true);
277+
$headers = $this->headerInit( false, true );
278278
if ($app_id == '') {
279279
$app_id = $this->appId;
280280
}

0 commit comments

Comments
 (0)