Skip to content

feat: add metadataCallback to CallOptions - #9298

Merged
bshaffer merged 3 commits into
mainfrom
add-metadata-callback-support
Jul 6, 2026
Merged

feat: add metadataCallback to CallOptions#9298
bshaffer merged 3 commits into
mainfrom
add-metadata-callback-support

Conversation

@Hectorhammett

Copy link
Copy Markdown
Collaborator

Currently there is no way to get the response headers in an simple way from the user's perspective:

$response = $someClient->someMethod($request);
var_dump($response)// This is just a Proto object, we do not have access to the headers

The gRPC transport supports the metadataCallback callback. This PR allows the user to pass this callback to the CallOptions so the headers are easily accessible:

$responseHeaders = null;
$response = $someClient->someMethod($request, [
    'metadataCallback' => function (array $headers) use (&$responseHeader){
        $responseHeaders = $headers;
    }
])

var_dump($response) // The Proto object
var_dump($responseHeaders) // The response headers in an array

@Hectorhammett
Hectorhammett requested a review from a team as a code owner June 24, 2026 20:00
@Hectorhammett
Hectorhammett force-pushed the add-metadata-callback-support branch 3 times, most recently from b719471 to bfc6fb4 Compare June 24, 2026 20:21
@Hectorhammett Hectorhammett added next release PRs to be included in the next release and removed next release PRs to be included in the next release labels Jun 25, 2026
@Hectorhammett
Hectorhammett force-pushed the add-metadata-callback-support branch from bfc6fb4 to f3f0f0c Compare July 6, 2026 19:53
@bshaffer
bshaffer enabled auto-merge (squash) July 6, 2026 20:13
@bshaffer bshaffer changed the title feat: Add support for metadataCallback on client options feat: add metadataCallback to CallOptions Jul 6, 2026
@bshaffer
bshaffer merged commit 6a6d4a9 into main Jul 6, 2026
40 checks passed
@bshaffer
bshaffer deleted the add-metadata-callback-support branch July 6, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants