mirror of
https://gitee.com/yansongda/pay.git
synced 2024-11-29 18:58:38 +08:00
fix: 支付宝 wap/web 支付 get 方法时url拼接问题 (#488)
* fix: 支付宝 wap/web 支付 get 方法时url拼接问题 * style: code style optimized
This commit is contained in:
parent
660fa5ef12
commit
c88f0c2d5c
@ -9,7 +9,6 @@ use GuzzleHttp\Psr7\Response;
|
||||
use Yansongda\Pay\Contract\PluginInterface;
|
||||
use Yansongda\Pay\Logger;
|
||||
use Yansongda\Pay\Rocket;
|
||||
use Yansongda\Supports\Arr;
|
||||
use Yansongda\Supports\Collection;
|
||||
|
||||
class HtmlResponsePlugin implements PluginInterface
|
||||
@ -36,7 +35,7 @@ class HtmlResponsePlugin implements PluginInterface
|
||||
|
||||
protected function buildRedirect(string $endpoint, Collection $payload): Response
|
||||
{
|
||||
$url = $endpoint.'?'.Arr::query($payload->all());
|
||||
$url = $endpoint.(false === strpos($endpoint, '?') ? '?' : '&').$payload->query();
|
||||
|
||||
$content = sprintf('<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -25,6 +25,20 @@ class HtmlResponsePluginTest extends TestCase
|
||||
self::assertEquals('https://yansongda.cn?name=yansongda', $result->getDestination()->getHeaderLine('Location'));
|
||||
}
|
||||
|
||||
public function testRedirectIncludeMark()
|
||||
{
|
||||
$rocket = new Rocket();
|
||||
$rocket->setRadar(new Request('GET', 'https://yansongda.cn?charset=utf8'))
|
||||
->setPayload(new Collection(['name' => 'yansongda']));
|
||||
|
||||
$plugin = new HtmlResponsePlugin();
|
||||
$result = $plugin->assembly($rocket, function ($rocket) { return $rocket; });
|
||||
|
||||
self::assertInstanceOf(ResponseInterface::class, $result->getDestination());
|
||||
self::assertArrayHasKey('Location', $result->getDestination()->getHeaders());
|
||||
self::assertEquals('https://yansongda.cn?charset=utf8&name=yansongda', $result->getDestination()->getHeaderLine('Location'));
|
||||
}
|
||||
|
||||
public function testHtml()
|
||||
{
|
||||
$rocket = new Rocket();
|
||||
|
Loading…
Reference in New Issue
Block a user