How to add customize attribute of fetch in hono/client? Like credentials: true #1054
-
We can use Hono Client in FE code, but when I try to add credentials in fetch options, I don't know how. I read your team code base in testing and pass the mock fetch with the response. So anyone knows how to add some property like this in fetch? Thank you Here the code $post = honoClient.xyz.post
await $post({ query: {}, { fetch: () => fetch() ???? }) |
Beta Was this translation helpful? Give feedback.
Answered by
yusukebe
Apr 30, 2023
Replies: 2 comments
-
Hi @harrytran998 ! You can do it by this way: await $get(
{
query: {},
},
{
fetch: (req) => {
return fetch(req, {
headers: {
foo: 'bar',
},
})
},
}
) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
harrytran998
-
Oh - it worked! Thank you so much 🙏 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @harrytran998 !
You can do it by this way: