mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
Wrapping text in json object with 'data' as key
Some checks failed
tests / ci (push) Has been cancelled
Some checks failed
tests / ci (push) Has been cancelled
This commit is contained in:
parent
52dfe92054
commit
10b53c3772
2 changed files with 2 additions and 2 deletions
|
|
@ -243,7 +243,7 @@ class Plugin extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response doesn't seem to be JSON, wrap the response body text as a JSON object
|
// 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) {
|
} catch (Exception $e) {
|
||||||
Log::warning('Failed to parse JSON response: '.$e->getMessage());
|
Log::warning('Failed to parse JSON response: '.$e->getMessage());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ test('plugin wraps plain text response body as JSON', function (): void {
|
||||||
$plugin->refresh();
|
$plugin->refresh();
|
||||||
|
|
||||||
expect($plugin->data_payload)->toBe([
|
expect($plugin->data_payload)->toBe([
|
||||||
'text' => 'Lorem ipsum dolor sit amet',
|
'data' => 'Lorem ipsum dolor sit amet',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue