Skip to content

Commit 404416d

Browse files
committed
those tests were too flaky; this is reliable
1 parent 2c2074f commit 404416d

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/IPinfo.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct($access_token = null, $settings = [])
3535
*/
3636
$guzzle_opts = [
3737
'http_errors' => false,
38+
'headers' => $this->buildHeaders(),
3839
'timeout' => $settings['timeout'] ?? self::REQUEST_TIMEOUT_DEFAULT
3940
];
4041
if (isset($settings['guzzle_opts'])) {
@@ -108,10 +109,7 @@ public function getRequestDetails(string $ip_address)
108109
try {
109110
$response = $this->http_client->request(
110111
self::REQUEST_TYPE_GET,
111-
$url,
112-
[
113-
'headers' => $this->buildHeaders()
114-
]
112+
$url
115113
);
116114
} catch (GuzzleException $e) {
117115
throw new IPinfoException($e->getMessage());

tests/IPinfoTest.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,6 @@ public function testLookup()
114114
$this->assertEquals($res->domains['ip'], '8.8.8.8');
115115
}
116116

117-
public function testTimeoutOverride()
118-
{
119-
$tok = getenv('IPINFO_TOKEN');
120-
if (!$tok) {
121-
$this->markTestSkipped('IPINFO_TOKEN env var required');
122-
}
123-
124-
$h = new IPinfo($tok, ['timeout' => 0.1]);
125-
$ip = "8.8.8.8";
126-
127-
$this->expectException(IPinfoException::class);
128-
$res = $h->getDetails($ip);
129-
}
130-
131117
public function testGuzzleOverride()
132118
{
133119
$tok = getenv('IPINFO_TOKEN');
@@ -136,7 +122,9 @@ public function testGuzzleOverride()
136122
}
137123

138124
$h = new IPinfo($tok, ['guzzle_opts' => [
139-
'timeout' => 0.1
125+
'headers' => [
126+
'authorization' => 'Bearer blah'
127+
],
140128
]]);
141129
$ip = "8.8.8.8";
142130

0 commit comments

Comments
 (0)