surf
surf copied to clipboard
WASM Polish
#25 introduces a minimal WASM backend for Surf. In order to make it production ready, we should:
- [x] support different methods on request
- [ ] support body uploads
- [ ] remove all unwraps
- [ ] set headers on request
- [x] get headers from response
- [x] create an internal
fetchclient abstraction to get ready to move the bulk of the code togloo
Thanks!
It would also be nice to have the ability to abort/drop requests in WASM environments. I'm not sure if this is possible with Hyper but I can think of a number of cases where aborting requests would be useful in a browser.
@liamcurry for sure; we could do this as a Drop impl on runtime-wasm using the fetch observer API. We'd need to do some runtime feature detection though because it's not universally available in browsers, but it would def be cool to have!
@yoshuawuyts Would it make sense to use XHR instead since that is available in all browsers? From what I can tell the only difference between the two is that fetch uses promises, which would be irrelevant here. Asynchronous XHR requests seem to be allowed in Service Workers too.
@liamcurry my understanding is that spec authors consider XHR to be deprecated in all but name, so I feel it might make most sense for us to keep building on fetch — even if not all features are equally available everywhere.