Add reusable GeoIP client#7
Conversation
Greptile SummaryThis PR introduces a reusable
Confidence Score: 4/5Safe to merge after fixing the Authorization header accumulation in GeoIp::get(). Every call to get() appends a fresh Authorization header to the shared $this->client instance. A GeoIp object reused for multiple lookups will send duplicate bearer tokens that grow with each call, causing failures on the second and subsequent requests. src/Geo/GeoIp.php — the Authorization header setup in get() should move to the constructor. Important Files Changed
Reviews (4): Last reviewed commit: "Return Geo records from GeoIP client" | Re-trigger Greptile |
| "require": { | ||
| "php": ">=8.3.0", | ||
| "utopia-php/fetch": "0.5.*", | ||
| "utopia-php/fetch": "0.5.* || ^1.1", |
There was a problem hiding this comment.
The lock file and CI run against 0.5.1. The ^1.1 range is added so downstream consumers on 1.x can install this package, but neither GeoIp.php nor GeoIpTest.php has been validated against 1.x — specifically the constructor signature of Utopia\Fetch\Response used in the test mocks and the constants (CONTENT_TYPE_APPLICATION_JSON, METHOD_GET) used in the main class. If 1.x introduced API changes, consumers who land on 1.x could get silent failures. Running CI with a second composer update targeting ^1.1 would close this gap.
0e7582c to
369550f
Compare
369550f to
66228fa
Compare
Adds a reusable GeoIP HTTP client for consumers that need to call the Geo service.\n\nChanges:\n- Add Appwrite\Geo\GeoIp with get() and getCountryCode() methods.\n- Add unit coverage for successful lookup, missing country, HTTP errors, fetch exceptions, and disabled endpoint/secret behavior.\n- Add a unit PHPUnit suite.\n- Widen utopia-php/fetch support so consumers already on newer fetch versions can install the package.