Skip to content

feat: Add support for metadataCallback on client options#9298

Open
Hectorhammett wants to merge 1 commit into
mainfrom
add-metadata-callback-support
Open

feat: Add support for metadataCallback on client options#9298
Hectorhammett wants to merge 1 commit 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 2 times, most recently from bcc0f31 to b719471 Compare June 24, 2026 20:20
@Hectorhammett Hectorhammett force-pushed the add-metadata-callback-support branch from b719471 to bfc6fb4 Compare June 24, 2026 20:21
@Hectorhammett Hectorhammett added the next release PRs to be included in the next release label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next release PRs to be included in the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant