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

Make http.Client work in Web workers #1411

Open
kaoet opened this issue Nov 26, 2024 · 0 comments
Open

Make http.Client work in Web workers #1411

kaoet opened this issue Nov 26, 2024 · 0 comments
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@kaoet
Copy link

kaoet commented Nov 26, 2024

In Web workers, there is no window object, so the current http.Client doesn't work since it explicitly calls window.fetch():

final response = await window
.fetch(

There is WorkerGlobalScope.fetch in Web workers. Please don't hardcode window and make it also work in Web workers. Maybe like what fetch_api does:

https://github.com/Zekfad/fetch_api/blob/c3c8de685b4f35079f0c0d9dcfa259afa18e8594/lib/src/fetch.dart#L7-L8

@kaoet kaoet added package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant