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: allow providing custom fetch implementation #24

Merged
merged 1 commit into from
Nov 8, 2021
Merged

feat: allow providing custom fetch implementation #24

merged 1 commit into from
Nov 8, 2021

Conversation

jacobwgillespie
Copy link
Contributor

@jacobwgillespie jacobwgillespie commented Nov 6, 2021

What kind of change does this PR introduce?

This PR adds the ability to provide a custom fetch implementation as an option - this is most useful for environments where cross-fetch is not supported, for instance Cloudflare Workers or Vercel Edge Functions.

This is related to supabase/supabase-js#154, and I believe a similar option would need to be added to the other libraries using cross-fetch before being finally added to supabase-js.

What is the current behavior?

At the moment, cross-fetch is always used in all environments.

What is the new behavior?

There is a new option fetch that can be provided to override cross-fetch with an alternative library (or the native fetch):

import { SupabaseStorageClient } from '@supabase/storage-js'

const url = '...'
const headers = {}
const fetch = ...

const storage = new SupabaseStorageClient(url, headers, fetch)

Additional context

Wrapped library PRs:

supabase-js PR:

@kiwicopple kiwicopple merged commit 6756b13 into supabase:main Nov 8, 2021
@kiwicopple
Copy link
Member

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants