Skip to content

Commit f5012e4

Browse files
committed
Make content type mandatory since BBB 2.7.8
# Conflicts: # src/BigBlueButton.php
1 parent d87989a commit f5012e4

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/BigBlueButton.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,18 +558,24 @@ private function sendRequest(string $url, string $payload = '', string $contentT
558558
}
559559
}
560560

561+
// Initialise headers array with mandatory Content-type
562+
$headers = [
563+
'Content-type: ' . $contentType,
564+
];
565+
561566
// PAYLOAD
562567
if (!empty($payload)) {
563568
curl_setopt($ch, CURLOPT_HEADER, 0);
564569
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
565570
curl_setopt($ch, CURLOPT_POST, 1);
566571
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
567-
curl_setopt($ch, CURLOPT_HTTPHEADER, [
568-
'Content-type: ' . $contentType,
569-
'Content-length: ' . strlen($payload),
570-
]);
572+
// Add Content-length header if payload is present
573+
$headers[] = 'Content-length: ' . strlen($payload);
571574
}
572575

576+
// Set HTTP headers
577+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
578+
573579
// OTHERS
574580
foreach ($this->curlOpts as $opt => $value) {
575581
curl_setopt($ch, $opt, $value);

0 commit comments

Comments
 (0)