-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling grpc response headers, propagate response headers wi…
…th grpc error metadata
- Loading branch information
1 parent
ddb3e21
commit e041c42
Showing
3 changed files
with
81 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spiral\RoadRunner\GRPC\Internal; | ||
|
||
use Spiral\RoadRunner\GRPC\ServiceInterface; | ||
|
||
/** | ||
* @internal | ||
* @psalm-internal Spiral\RoadRunner\GRPC | ||
*/ | ||
final class CallContext | ||
{ | ||
/** | ||
* @param class-string<ServiceInterface> $service | ||
* @param non-empty-string $method | ||
* @param array<string, array<string>> $context | ||
*/ | ||
public function __construct( | ||
public string $service, | ||
public string $method, | ||
public array $context, | ||
) { | ||
} | ||
|
||
/** | ||
* @throws \JsonException | ||
*/ | ||
public static function decode(string $payload): self | ||
{ | ||
$data = Json::decode($payload); | ||
|
||
return new self( | ||
service: $data['service'], | ||
method: $data['method'], | ||
context: $data['context'], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters