Merge pull request #14293 from nextcloud/fix-ocm-implementation

According to the OCM specification the body needs to be JSON encoded
This commit is contained in:
Roeland Jago Douma 2019-02-20 08:49:54 +01:00 committed by GitHub
commit 10ae7af87f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,7 +134,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
public function sendShare(ICloudFederationShare $share) {
$cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith());
$ocmEndPoint = $this->getOCMEndPoint($cloudID->getRemote());
if (empty($ocmEndPoint)) {
return false;
}
@ -142,7 +141,8 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
$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,
]);
@ -181,7 +181,8 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
$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,
]);