Wrapping text in json object with 'data' as key

This commit is contained in:
kwlo 2025-11-03 21:58:36 -05:00
parent e0323015c7
commit 8e5944393d
2 changed files with 2 additions and 2 deletions

View file

@ -243,7 +243,7 @@ class Plugin extends Model
}
// Response doesn't seem to be JSON, wrap the response body text as a JSON object
return ['text' => $httpResponse->body()];
return ['data' => $httpResponse->body()];
} catch (Exception $e) {
Log::warning('Failed to parse JSON response: '.$e->getMessage());

View file

@ -113,7 +113,7 @@ test('plugin wraps plain text response body as JSON', function (): void {
$plugin->refresh();
expect($plugin->data_payload)->toBe([
'text' => 'Lorem ipsum dolor sit amet',
'data' => 'Lorem ipsum dolor sit amet',
]);
});