-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
namespace SimPod\ClickHouseClient\Client\Http; | ||
|
||
use GuzzleHttp\Psr7\MultipartStream; | ||
use InvalidArgumentException; | ||
use Psr\Http\Message\RequestFactoryInterface; | ||
use Psr\Http\Message\RequestInterface; | ||
|
@@ -50,7 +51,11 @@ public function prepareRequest(RequestOptions $requestOptions): RequestInterface | |
PHP_QUERY_RFC3986, | ||
); | ||
|
||
$body = $this->streamFactory->createStream($requestOptions->sql); | ||
// $body = $this->streamFactory->createStream($requestOptions->sql); | ||
// $body = $this->streamFactory->createStream(http_build_query(['query'=>$requestOptions->sql])); | ||
// $body = $this->streamFactory->createStream(http_build_query(['query'=>'select 1', 'param_p1'=>'value_p1'])); | ||
$body = new MultipartStream([[ 'name' => 'query', 'contents' => $requestOptions->sql ]]); | ||
Check failure on line 57 in src/Client/Http/RequestFactory.php GitHub Actions / Coding Standards (8.2)
Check failure on line 57 in src/Client/Http/RequestFactory.php GitHub Actions / Coding Standards (8.2)
Check failure on line 57 in src/Client/Http/RequestFactory.php GitHub Actions / Coding Standards (8.2)
Check failure on line 57 in src/Client/Http/RequestFactory.php GitHub Actions / Static Analysis with PHPStan (8.2)
|
||
$boundary = $body->getBoundary(); | ||
|
||
if ($this->uri === null) { | ||
$uri = $query === '' ? '' : '?' . $query; | ||
|
@@ -64,6 +69,8 @@ public function prepareRequest(RequestOptions $requestOptions): RequestInterface | |
} | ||
|
||
$request = $this->requestFactory->createRequest('POST', $uri); | ||
$request = $request->withHeader('Content-Type', 'multipart/form-data; boundary='.$boundary); | ||
Check failure on line 72 in src/Client/Http/RequestFactory.php GitHub Actions / Coding Standards (8.2)
Check failure on line 72 in src/Client/Http/RequestFactory.php GitHub Actions / Coding Standards (8.2)
Check failure on line 72 in src/Client/Http/RequestFactory.php GitHub Actions / Coding Standards (8.2)
Check warning on line 72 in src/Client/Http/RequestFactory.php GitHub Actions / Infection
Check failure on line 72 in src/Client/Http/RequestFactory.php GitHub Actions / Static Analysis with PHPStan (8.2)
|
||
// $request = $request->withHeader('Content-Type', 'multipart/form-data; boundary=' . $requestOptions->boundary); | ||
try { | ||
$request = $request->withBody($body); | ||
} catch (InvalidArgumentException) { | ||
|