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

feat: make requests extendable by adding requestMiddleware to provider options #1822

Merged
merged 19 commits into from
Mar 7, 2024

Conversation

nedsalk
Copy link
Contributor

@nedsalk nedsalk commented Feb 29, 2024

This PR introduces a requestMiddleware callback as a way to modify the request object for every fetch call made towards the network. I didn't ponder about adding the capability for modifying the request object on a per-call basis because that'd be a bigger piece of work and we need at least this functionality for a bugfix on our apps related to sticky session cookies not being included. You can find more on that in the related issue.

closes #1821

@nedsalk nedsalk added the feat Issue is a feature label Feb 29, 2024
@nedsalk nedsalk self-assigned this Feb 29, 2024
@nedsalk nedsalk requested a review from Dhaiwat10 March 2, 2024 10:49
Dhaiwat10
Dhaiwat10 previously approved these changes Mar 4, 2024
Copy link
Member

@Dhaiwat10 Dhaiwat10 left a comment

Choose a reason for hiding this comment

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

Nice one @nedsalk

packages/account/src/providers/provider.ts Outdated Show resolved Hide resolved
@Dhaiwat10
Copy link
Member

I would change the PR title to something that includes the word 'requestMiddleware just for more clarity

@nedsalk nedsalk changed the title feat: make requests extendable feat: make requests extendable by adding requestMiddleware to provider options Mar 4, 2024
Copy link
Contributor

@danielbate danielbate left a comment

Choose a reason for hiding this comment

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

Nice work @nedsalk. Should this be documented?

packages/account/src/providers/provider.ts Show resolved Hide resolved
Copy link
Contributor

@Torres-ssf Torres-ssf left a comment

Choose a reason for hiding this comment

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

I agree with @danielbate, we need some docs examples about this feature.

@nedsalk
Copy link
Contributor Author

nedsalk commented Mar 5, 2024

@danielbate @Torres-ssf Added docs in a1e6dc4 and 10d7176.

@nedsalk nedsalk enabled auto-merge (squash) March 5, 2024 09:20
danielbate
danielbate previously approved these changes Mar 5, 2024
Copy link
Contributor

github-actions bot commented Mar 7, 2024

Coverage Report:

Lines Branches Functions Statements
79.46%(+0.01%) 70.2%(+0.03%) 78.04%(+0%) 79.54%(+0%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/provider.ts 78.35%
(+0.08%)
64.56%
(+0.56%)
85.07%
(+0%)
79.06%
(+0.08%)

Copy link
Contributor

@petertonysmith94 petertonysmith94 left a comment

Choose a reason for hiding this comment

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

Super clean 🥇

@nedsalk nedsalk merged commit 950f9be into master Mar 7, 2024
13 checks passed
@nedsalk nedsalk deleted the ns/feat/extend-request-object branch March 7, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow extension of request objects
6 participants