-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Make it possible to pass custom fetch to rest data source #1807
Conversation
@jbachhardie: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
Codecov Report
@@ Coverage Diff @@
## master #1807 +/- ##
==========================================
- Coverage 77.8% 73.89% -3.92%
==========================================
Files 30 29 -1
Lines 1149 1153 +4
Branches 268 297 +29
==========================================
- Hits 894 852 -42
- Misses 245 290 +45
- Partials 10 11 +1
Continue to review full report at Codecov.
|
This is an optional constructor parameter. If a custom fetch function is not defined, the default fetch will be used. This new functionality has been covered in the http cache tests. Co-Authored-By: Emily McDonald <mcdonald.emily@live.co.uk>
Is there an ETA when the conflicts will be resolved and merged? I am finding this to be a useful feature as well. |
@jbachhardie plz merge it ASAP |
I've resolved the conflicts (which were just changelog stuff) if that's what you mean. I can't merge the PR since I'm not a maintainer. |
@jbachhardie plz pull last master |
@abernix can you help with this pr, i want to use custom fetch in the data source, because i have a good sdk client, so i want to use this "custom fetch" with data source, i don`t want to replace cache logic, plz ASAP |
@martijnwalraven @abernix @evans merge it please |
Hey, how is this feature going guys ? I also need it and it looks it's ready for merging ... Thanks ! |
@jbachhardie do you have an example of how a custom fetch could be used with this? |
Would be really awesome to have this so that fetch could be easily instrumented. |
Hey, @jbachhardie, @martijnwalraven, and @abernix :) Do you know if there is any chance of this getting merged? I'm looking to use https://www.npmjs.com/package/fetch-retry for retry logic whilst avoiding creating my own |
Thanks very much for working on this @jbachhardie. We'll get this merged shortly. |
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 great @jbachhardie - thanks very much!
I am trying to add in willSendRequest(request) {
request.headers.set('Authorization', `Bearer ${this.context.user.bearerToken}`)
} |
This addresses #1729
We were unsure whether it would be better for the
RESTDataSource
constructor to take afetch
implementation or an options object with afetch
property. We stuck to the former because it is simpler, not requiring the creation of a new type, and because theHTTPCache
constructor seems to be a precedent for this pattern.I know the feature hasn't been given the go-ahead but we were making these changes for our own use anyway and they're non-breaking so figured we'd put a PR in.
TODO: