Replies: 1 comment 10 replies
-
I built support for this before I had links, maybe it would make more sense to have it as part of links! Right now you have it when you initialize the client. Here's an example: const client = createTRPCClient<AppRouter>({
links: [
() =>
({ op, prev, next }) => {
console.log('->', op.type, op.path, op.input);
return next(op, (result) => {
console.log('<-', op.type, op.path, op.input, ':', result);
prev(result);
});
},
httpBatchLink({ url }),
],
headers() {
// do whatever you want here - will be called for every request
return {
'x-cat': 'MEOW',
}
}
}); I would love some improved docs on this! 🙏 |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey!
I'm trying to gain access to the response headers for each request processed via the vanilla client. My assumption is that this would be available through a link, but I can't find a way to reference the headers anywhere.
Happy to contribute docs!
Beta Was this translation helpful? Give feedback.
All reactions