我想查询的地方自动完成API由谷歌,使用下面的代码片断谷歌地方网页API不SuperAgent的
request.get(`https://maps.googleapis.com/maps/api/place/autocomplete/`).query(params)
有了正确的PARAMS的代码将失败的合作,给我一个CORS例外
Failed to load https://maps.googleapis.com/maps/api/place/autocomplete/json?input=amsterdam&key={super secret key}: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:7000' is therefore not allowed access.
如果我切换到我的网络选项卡,我可以看到请求本身工作得很好,它甚至会返回我想要的日期。
我正在与superagent-es6-promise合作。
相关https://stackoverflow.com/questions/44336773/google-maps-api-no-access-control-allow-origin-header-is-present-on-the-reque/44339169#44339169和https: //stackoverflow.com/questions/43443836/angular-cors-jsonp-and-google-maps-http-api-calls/43444274#43444274 – sideshowbarker