Skip to content

Commit

Permalink
According to the OCM specification the body needs to be JSON encoded
Browse files Browse the repository at this point in the history
see: cs3org/OCM-API#37

Signed-off-by: Bjoern Schiessle <[email protected]>
  • Loading branch information
schiessle committed Feb 19, 2019
1 parent e7f0e8b commit 5ad8617
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/private/Federation/CloudFederationProviderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ public function getCloudFederationProvider($resourceType) {
public function sendShare(ICloudFederationShare $share) {
$cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith());
$ocmEndPoint = $this->getOCMEndPoint($cloudID->getRemote());

if (empty($ocmEndPoint)) {
return false;
}

$client = $this->httpClientService->newClient();
try {
$response = $client->post($ocmEndPoint . '/shares', [
'body' => $share->getShare(),
'body' => json_encode($share->getShare()),
'headers' => ['content-type' => 'application/json'],
'timeout' => 10,
'connect_timeout' => 10,
]);
Expand Down Expand Up @@ -181,7 +181,8 @@ public function sendNotification($url, ICloudFederationNotification $notificatio
$client = $this->httpClientService->newClient();
try {
$response = $client->post($ocmEndPoint . '/notifications', [
'body' => $notification->getMessage(),
'body' => json_encode($notification->getMessage()),
'headers' => ['content-type' => 'application/json'],
'timeout' => 10,
'connect_timeout' => 10,
]);
Expand Down

0 comments on commit 5ad8617

Please sign in to comment.