-
Notifications
You must be signed in to change notification settings - Fork 570
It caused "dial tcp 127.0.0.1:8881: setsockopt: bad address" error when I used client.Do from "net/http" module in golang #663
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
@fearblackcat take a look through the wiki on guidance regarding https://github.com/gopherjs/gopherjs/wiki/JavaScript-Tips-and-Gotchas Line starts "For making HTTP requests..." |
Yes, it does. I use You need to use |
@shurcooL I changed the http.Transport to http.DefaultTransport and run my code in nodejs server side. But it also cannot be used. It seems that server side doesn't import fetch and xmlhttpRequest package. So is there any way to resolve it? These is my code. client := &http.Client{ Transport: http.DefaultTransport, } resp, err := client.Do(req) Maybe I should try to adopt @myitcv advice |
My advice was for using It doesn't work for node, because node doesn't provide those APIs. You'd need to install a polyfill. See #586. But if you need to run it on backend instead of browser, why not use normal Go compiler? |
@shurcooL Thanks to reply. It helps me enormously |
Does gopherjs support net/http module in golang ?
The text was updated successfully, but these errors were encountered: