简体   繁体   English

浏览器获取请求 404'd 但适用于 Postman 应用程序

[英]Browser get request 404'd but works with Postman app

Title says it all, trying to retrieve some data with the openweather api.标题说明了一切,尝试使用 openweather api 检索一些数据。

It works fine on Postman, however when using vanillaJS in a local environment I get an error message in console它在 Postman 上运行良好,但是在本地环境中使用 vanillaJS 时,我在控制台中收到一条错误消息

ERROR: GET http://127.0.0.1:5500/api.openweathermap.org/data/2.5/forecast?id=2193733&appid=MYAPIKEY 404 (Not Found)

My code looks like this我的代码看起来像这样

axios.get(`api.openweathermap.org/data/2.5/forecast?id=2193733&appid=MYAPIKEY`)
         .then(response => {
             console.log(response);
         })

Any ideas?有任何想法吗?

You are getting the request Sent on top of your app that's running axios.您正在运行 axios 的应用程序顶部收到发送的请求。

Try axios.get('http://api.openwheather...') and it should work尝试axios.get('http://api.openwheather...')它应该可以工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么相同的POST请求在POSTMAN中起作用,但在浏览器AJAX中却不起作用(找不到404)? - Why the same POST request works in POSTMAN but not in browser AJAX (404 Not Found)? GET 请求通过 Axios 返回错误 404,但在 Postman 中有效? - GET request returns Error 404 through Axios, but works in Postman? Postman 获取请求有效,但在浏览器中无效 - react/mongoose/express - Postman Get request works but not in browser- react/mongoose/express 简单的 POST 请求在 Postman 中有效,但在浏览器中无效 - Simple POST request works in Postman but not in browser 未找到 Web API POST(在浏览器上抛出 404)但适用于 PostMan 和 Swagger - Web API POST not found (throws 404 on browser) but works on PostMan and Swagger GET 请求从浏览器和邮递员工作,但在 React App 中从本地主机失败,端点是否必须添加访问控制允许来源? - GET request works from browser & Postman but fails from localhost in React App, does the endpoint necessarily have to add access-control-allow-origin? 当我通过react应用发出请求时,我的网络服务器会发送404,但是当我直接通过chrome或postman访问它时,我的服务器工作正常 - My webserver sends 404 when i make the request through react app, but works fine when I access it directly through chrome or postman Postman GET 请求有效,但 Ajax CORS 无效 - Postman GET request works but not Ajax CORS redash GET 请求适用于 POSTMAN 但不适用于 axios - redash GET request works on POSTMAN but not on axios API适用于Postman,但不适用于浏览器 - API works in Postman, but not on a browser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM