问题
How can I set options in the fetch method of react-native to make a call to a webserver go through a proxy.
Currently I am using axios but this doesn't work.
After adding a host header to the fetch, I can make a request through charles-proxy but it doesn't work with squid. (Error: invalid url).
回答1:
Hello You can use this module node-fetch(https://github.com/bitinn/node-fetch) and set agent param for proxy,
For more details, you can also check this https://github.com/bitinn/node-fetch/issues/79
来源:https://stackoverflow.com/questions/42674258/react-native-fetch-through-proxy