-
Notifications
You must be signed in to change notification settings - Fork 48
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 fetch on worker scripts(web-worker, service-worker) #23
Conversation
@yoshuawuyts Greetings! Would you mind giving me some guidance over making this PR into an acceptable state? While currently http-client -> surf supports running on wasm, it will only allow making requests on the windows_global_scope, which for users seeking to use it inside web-worker or service-worker will receive runtime error by using This PR simply get the global_scope in runtime, so request and fetch api can be used alongside http-client -> surf. |
rebase |
…nt into worker_global_scope
@extraymond hi! -- sorry for not catching this sooner; yes we should definitely merge this. If you can fix the merge conflicts we can merge + release it. |
@yoshuawuyts No biggie, conflict resolved now. |
@extraymond it seems the CI is currently failing to compile WASM, and it may also need a |
This fixes a bug where duplicate headers would only use one value. Possibly related to http-rs/surf#220
Fixes the IsahcClient to work wiith async_trait from a943eb9
Only the wasm client uses it and it is not light.
Fixes a bug from 8bcf81f
Prevents users from writing `HttpClient {}`.
- Makes HyperClient impl Clone and Default - Re-uses the internal hyper client for pooling and alloc efficiency - Adds HyperClient::from_client() - Always uses the HttpsConnector (has internal http fallback) Required for hyper-client in Surf: http-rs/surf#234
Avoid leaking Hyper generics into HttpClient by hiding it behind a dynamic trait object pointer.
This fixes a forbid rust_2018_idioms issue.
…nt into worker_global_scope
rebase again |
It seems I'm messing stuff up. |
continue at #50 |
Hi! I've adapted the code copied from the gloo crate(related_section) to allow wasm-client to use fetch under worker environments.
Stumbled upon this when trying cloudflare workers(which is using service worker).