Skip to content

How to pass headers "on the fly"…? #555

@hedefalk

Description

@hedefalk

I'm trying to move from my own wrapping with react-query to this lib.

I need to pass headers on the fly per request. Previously I've done that with the "headers" field of the generated client methods from @connectrpc/connect:

   MyClient.getSomeThing(
      { ...params},
      { headers: headers(veryDynamicFieldThatChanges) },
    ); 

These I manually wrapped with @tanstack/react-query, but I do see a benefit of using this lib, but I can't see that I can pass my headers through?

I did see #519 but maybe op was fine with the transport based one. I doesn't really work for me as these headers are needed on the lowest level - would have to recreate transport on each call which seems wrong?

Is there possibly an option I've missed? Maybe my use case is rare…?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions