Skip to content

Commit 5da33ad

Browse files
committed
Fix Query URL
1 parent d8df50f commit 5da33ad

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

HttpClientTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ private static function resolveUrl(array $url, ?array $base, array $queryDefault
422422
$url['path'] = '/';
423423
}
424424

425+
if ('?' === ($url['query'] ?? '')) {
426+
$url['query'] = null;
427+
}
428+
425429
return $url;
426430
}
427431

Tests/HttpClientTraitTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public function providePrepareRequestUrl(): iterable
4444
yield ['http://example.com/?a=2&b=b', '.?a=2'];
4545
yield ['http://example.com/?a=3&b=b', '.', ['a' => 3]];
4646
yield ['http://example.com/?a=3&b=b', '.?a=0', ['a' => 3]];
47+
yield ['http://example.com/', 'http://example.com/', ['a' => null]];
48+
yield ['http://example.com/?b=', 'http://example.com/', ['b' => '']];
49+
yield ['http://example.com/?b=', 'http://example.com/', ['a' => null, 'b' => '']];
4750
}
4851

4952
/**

0 commit comments

Comments
 (0)