Skip to content

Commit

Permalink
Add request info in response
Browse files Browse the repository at this point in the history
  • Loading branch information
ttrig committed Dec 29, 2023
1 parent bcfb74b commit 277811f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Request info in response.

## [0.5.1] - 2023-03-10
### Added
Expand Down
4 changes: 4 additions & 0 deletions src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ private function gatherAbout(): array
'butler_health' => [
'version' => ltrim(InstalledVersions::getPrettyVersion('glesys/butler-health'), 'v'),
],
'request' => [
'ip' => request()->ip(),
'user_agent' => request()->userAgent(),
],
];

$data = array_merge_recursive(
Expand Down
3 changes: 3 additions & 0 deletions tests/RepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function test_invoke_returns_correct_default_information()
)
)
->has('butler_health.version')
->has('request', fn (AssertableJson $json) => $json
->hasAll('ip', 'user_agent')
)
)
->where('checks', [
[
Expand Down

0 comments on commit 277811f

Please sign in to comment.