mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 11:48:08 +08:00
add \Hyperf\GrpcClient\Request
This commit is contained in:
parent
1678cf7018
commit
3dd49d2874
@ -17,7 +17,6 @@ use Hyperf\Grpc\Parser;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Hyperf\Utils\ChannelPool;
|
||||
use InvalidArgumentException;
|
||||
use Swoole\Http2\Request;
|
||||
|
||||
/**
|
||||
* @method int send(Request $request)
|
||||
@ -84,7 +83,6 @@ class BaseClient
|
||||
$deserialize
|
||||
) {
|
||||
$request = new Request();
|
||||
$request->headers['content-type'] = 'application/grpc';
|
||||
$request->method = 'POST';
|
||||
$request->path = $method;
|
||||
$request->data = Parser::serializeMessage($argument);
|
||||
|
@ -19,7 +19,6 @@ use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Swoole\Coroutine\Channel;
|
||||
use Swoole\Coroutine\Http2\Client as SwooleHttp2Client;
|
||||
use Swoole\Http2\Request;
|
||||
|
||||
class GrpcClient
|
||||
{
|
||||
@ -210,7 +209,6 @@ class GrpcClient
|
||||
public function openStream(string $path, string $data = null, string $method = 'POST'): int
|
||||
{
|
||||
$request = new Request();
|
||||
$request->headers['content-type'] = 'application/grpc';
|
||||
$request->method = $method;
|
||||
$request->path = $path;
|
||||
if ($data) {
|
||||
|
25
src/grpc-client/src/Request.php
Normal file
25
src/grpc-client/src/Request.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\GrpcClient;
|
||||
|
||||
use Swoole\Http2\Request as BaseRequest;
|
||||
|
||||
class Request extends BaseRequest
|
||||
{
|
||||
const CONTENT_TYPE = 'application/grpc';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->headers['content-type'] = self::CONTENT_TYPE;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user