-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow fetch functions to pass headers #2004
Conversation
I also hesitated to add this to methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should get rid of the isArchiveUrl
conditional logic as it's not needed.
I also left a proposal to bake these headers into the Mina.Network
function, for convenience. That's not necessary, but I think it could be nice.
I love the tests you added! Overall this looks great!
@dfstio , did you take a look at this implementation? Do you think it addresses your needs? |
I changed fetch functions again as I understand, removed isArchive and added setting headers feature in |
IMO yes let's add these as well. At least fetchActions and fetchEvents, because I think the archive node will make more use of this than the mina node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! I think it's ready to approve if you add a changelog entry, and I will wait to review those final changes from the Mina module you talked about.
Finally added to |
Thanks @kadirchan ! |
This PR opened for issue #1983
Two exposed method implemented to set default headers to be passed both Mina and Archive GraphQL nodes for fetch operations. Named
setMinaDefaultHeaders
,setArchiveDefaultHeaders
same as stated in issue.Also one new internal method to decide header to be sent to the server, after classify them between archive or not.
In addition optional per request header option parameters added to following methods:
fetchAccount
fetchLastBlock
fetchCurrentSlot
fetchTransactionStatus
sendZkapp
fetchEvents
fetchActions
fetchGenesisConstants
So that developers can decide between default header usage and one time only usage, and they can overwrite default headers with this usage.
Also unit-tests implemented by using mocking fetch.