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

Add fetch API handlers and clients #575

Merged
merged 3 commits into from
Apr 4, 2023
Merged

Conversation

timostamm
Copy link
Member

This adds the exports createFetchClient and createFetchHandler from @bufbuild/connect/protocol:

/**
 * Create a universal client function, a minimal abstraction of an HTTP client,
 * using the given fetch() implementation.
 */
function createFetchClient(fetchFn: typeof fetch): UniversalClientFn;

/**
 * Convert a universal handler function to a fetch handler.
 */
function createFetchHandler(uHandler: UniversalHandlerFn, options?: FetchHandlerOptions): FetchHandlerFn;

The two functions can be used with the transports and handlers from @bufbuild/connect/protocol-*. This is the first step towards supporting edge runtimes.

@timostamm timostamm requested a review from smaye81 April 4, 2023 21:21
packages/connect/src/protocol/universal-fetch.ts Outdated Show resolved Hide resolved
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.

2 participants