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

Allow a fetch override for connect-web #618

Merged
merged 8 commits into from
May 11, 2023
Merged

Conversation

dimitropoulos
Copy link
Contributor

@dimitropoulos dimitropoulos commented May 4, 2023

closes #403

This PR allows for passing in a custom fetch implementation, such as that used by sveltekit (and Angular zones, so I have it).

To really test this, you need to actually use it with one of these libraries, so I have done so as a proof of concept in connectrpc/examples-es@6ddf8e3.

it was unclear to me whether it was necessary to pull in `createFetchClient`, but this seems to do the trick in the most obvious possible way.
@bufdev bufdev changed the title allows for a fetch override for connect-web Allow a fetch override for connect-web May 4, 2023
Copy link
Member

@timostamm timostamm left a comment

Choose a reason for hiding this comment

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

This PR allows for passing in a custom fetch implementation, such as that used by sveltekit (and Angular zones, so I have it).

Sweet!

To really test this, you need to actually use it with one of these libraries, so I have done so as a proof of concept in bufbuild/connect-es-integration@6ddf8e3.

It looks like we are providing the Svelte fetch function to a client that makes both a unary and a server-streaming call, with the Connect protocol with the JSON format. Do both calls happen server side with this call, and no RPC request happens after page load?

Does this work with gRPC-web as well?

@dimitropoulos
Copy link
Contributor Author

Do both calls happen server side with this call, and no RPC request happens after page load?

yes

Does this work with gRPC-web as well?

yes

Copy link
Member

@timostamm timostamm left a comment

Choose a reason for hiding this comment

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

LGTM and follow up with a closer look at the constraints for SSR when we write the documentation.

Please have a look at CI first, though.

@dimitropoulos dimitropoulos merged commit 09d5d63 into main May 11, 2023
3 checks passed
@dimitropoulos dimitropoulos deleted the dimitri/custom-fetch branch May 11, 2023 19:51
This was referenced May 17, 2023
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.

Allow customizing fetch
3 participants