Skip to content

Commit 4f3b11f

Browse files
authored
Merge pull request #225 from nextcloud/fix/content-type
fix: content type identification
2 parents 553ad7c + d79191e commit 4f3b11f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Service/OpenAiAPIService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ public function request(?string $userId, string $endPoint, array $params = [], s
935935
if ($respCode >= 400) {
936936
return ['error' => $this->l10n->t('Bad credentials')];
937937
}
938-
if ($response->getHeader('Content-Type') === 'application/json') {
938+
if (str_starts_with(strtolower($response->getHeader('Content-Type')), 'application/json')) {
939939
$parsedBody = json_decode($body, true);
940940
if ($parsedBody === null) {
941941
$this->logger->warning('Could not JSON parse the response', ['body' => $body]);

0 commit comments

Comments
 (0)