Skip to content

Commit

Permalink
Camel case keys in response
Browse files Browse the repository at this point in the history
  • Loading branch information
ttrig committed Mar 25, 2024
1 parent 6fe4848 commit d1f7084
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- **BREAKING**: Require Laravel 11.
- **BREAKING**: Camel case keys in response.

## [0.5.2] - 2023-12-29
### Added
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The endpoint will return data in JSON.
"environment": {},
"cache": {},
"drivers": {},
"butler_health": {
"butlerHealth": {
"version": "0.1"
},
},
Expand Down Expand Up @@ -81,7 +81,7 @@ Extend `Butler\Health\Check` and add it to `butler.health.checks`, done.
You can push additional "about" information.

```php
Butler\Health\Repository::add('environment', ['operating_system' => php_uname('s')]);
Butler\Health\Repository::add('environment', ['operatingSystem' => php_uname('s')]);

Butler\Health\Repository::add('environment', fn () => ['time' => time()]);
```
Expand All @@ -90,12 +90,12 @@ Butler\Health\Repository::add('environment', fn () => ['time' => time()]);
{
"about": {
"environment": {
"operating_system": "Linux",
"operatingSystem": "Linux",
"time": 1678100209
},
"cache": {},
"drivers": {},
"butler_health": {},
"butlerHealth": {},
},
"checks": []
}
Expand Down
14 changes: 7 additions & 7 deletions src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ private function gatherAbout(): array

$data = [
'environment' => [
'application_name' => config('app.name'),
'laravel_version' => $laravel->version(),
'php_version' => phpversion(),
'composer_version' => $laravel->make(Composer::class)->getVersion(),
'applicationName' => config('app.name'),
'laravelVersion' => $laravel->version(),
'phpVersion' => phpversion(),
'composerVersion' => $laravel->make(Composer::class)->getVersion(),
'environment' => $laravel->environment(),
'debug_mode' => config('app.debug') ? true : false,
'debugMode' => config('app.debug') ? true : false,
'url' => str(config('app.url'))->replace(['http://', 'https://'], '')->toString(),
'timezone' => config('app.timezone'),
],
Expand All @@ -49,12 +49,12 @@ private function gatherAbout(): array
'queue' => config('queue.default'),
'session' => config('session.driver'),
],
'butler_health' => [
'butlerHealth' => [
'version' => ltrim(InstalledVersions::getPrettyVersion('glesys/butler-health'), 'v'),
],
'request' => [
'ip' => request()->ip(),
'user_agent' => request()->userAgent(),
'userAgent' => request()->userAgent(),
],
];

Expand Down
14 changes: 7 additions & 7 deletions tests/RepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public function test_invoke_returns_correct_default_information()
->has('about', fn (AssertableJson $json) => $json
->has('environment', fn (AssertableJson $json) => $json
->hasAll(
'application_name',
'laravel_version',
'php_version',
'composer_version',
'applicationName',
'laravelVersion',
'phpVersion',
'composerVersion',
'environment',
'debug_mode',
'debugMode',
'url',
)
->where('timezone', config('app.timezone'))
Expand All @@ -40,9 +40,9 @@ public function test_invoke_returns_correct_default_information()
'session',
)
)
->has('butler_health.version')
->has('butlerHealth.version')
->has('request', fn (AssertableJson $json) => $json
->hasAll('ip', 'user_agent')
->hasAll('ip', 'userAgent')
)
)
->where('checks', [
Expand Down

0 comments on commit d1f7084

Please sign in to comment.