-
Notifications
You must be signed in to change notification settings - Fork 570
net/http: recommend a polyfill for node.js #518
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
Comments
If there's an overall better replacement for |
Note: GopherJS's support for Node.js is only intended for package testing. For every normal workload it should be preferable to simply use normal Go. No suggestions on a polyfill, sorry. |
@broady You are not alone! I have tried an erred somewhat with this. Background: I am currently working on porting google cloud functions to many different languages, including clojure, f# and now golang:
Back to the matter at hand: I tried
For the fetch API. I also had to include https://www.npmjs.com/package/web-streams-polyfill to satisfy
I did have a lot more success with https://github.com/pwnall/node-xhr2 that worked and seems to be stable so far. My approach was to use create a file called polyfill.js (https://github.com/MartinSahlen/go-cloud-fn/blob/master/polyfill/polyfill.js) that imported the modules i needed and then use https://github.com/webpack/webpack to bundle all dependences into a standalone file (gopherjs doesnt handle this for us it seems, and no hard feelings, there are other tools doing that already). Final notes: So, I know gopherjs isnt meant to do this but at least this shows that it certainly is able to do it. The reason for me wanting this that is that google cloud functions currently are basically just handlers for the node express framework (and I love go ❤️ ). Maybe at some point it will work with node.js. I will be happy to discuss this further and contribute if there is a need and wish for it! |
xmlhttprequest
doesn't work very well:https://www.npmjs.com/package/xmlhttprequest
For some reason the first thing it does when it gets a request is abort it. wtf?!?!?
The text was updated successfully, but these errors were encountered: