Skip to content
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

opContext.credentials in fetch object in the batch plugin #167

Merged
merged 2 commits into from
Jul 31, 2022
Merged

opContext.credentials in fetch object in the batch plugin #167

merged 2 commits into from
Jul 31, 2022

Conversation

DaLukasDev
Copy link
Contributor

This adds the ability to use opContext.credentials in the batch plugin.

@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2022

Codecov Report

Merging #167 (65dbdc4) into main (1910a14) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #167   +/-   ##
=======================================
  Coverage   94.65%   94.66%           
=======================================
  Files          26       26           
  Lines         561      562    +1     
  Branches      112      112           
=======================================
+ Hits          531      532    +1     
  Misses         30       30           
Impacted Files Coverage Δ
packages/batch/src/index.ts 75.86% <100.00%> (+0.42%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us.

Copy link
Owner

@logaretm logaretm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. This is an excellent catch but let's try to solve it for any fetch option that might get passed here.

If you check the similar code in fetch.ts you can see it makes use of makeFetchOptions. We can do something similar by using the mergeFetchOpts function and merging the entire opContext into fetch options here.

Something like this:

const fetchOpts = mergeFetchOpts(opContext, { body });

response = await fetch(opContext.url as string, fetchOpts).then(parseResponse);

Also, a test for this use case would be great, but I can add it later.

@DaLukasDev
Copy link
Contributor Author

Something like this? I could try to write a test but it would be a first for me writing a test with jest 😅

@DaLukasDev DaLukasDev requested a review from logaretm July 31, 2022 16:16
@logaretm logaretm merged commit 2fb5cc5 into logaretm:main Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants