how to add custom headers by useCustom ?
how to add custom headers by useCustom ?
2 Replies
Hi @tingadev. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To add custom headers using the
useCustom
hook in refine, you can utilize the config.headers
property. Here's how you can do it:
In this example, we're adding a custom header "x-custom-header"
with the value "foo-bar"
to the request.
The config.headers
property allows you to specify custom headers for your API request. These headers will be passed to the custom
method of your data provider.
You can add multiple headers as needed:
This approach is documented in the useCustom Properties section of the refine documentation.
Remember that the exact behavior might depend on your data provider implementation. Make sure your data provider correctly handles the headers passed through the config
object.
useCustom Properties
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@761921731505946634> Kapa.ai is still learning and improving, please let me know how I did by reacting below.