简体   繁体   English

net::ERR_CONNECTION_RESET, Uncaught (in promise) TypeError: Failed to fetch

[英]net::ERR_CONNECTION_RESET, Uncaught (in promise) TypeError: Failed to fetch

I'm new to JavaScript and it's my first time ever using an API.我是 JavaScript 新手,这是我第一次使用 API。 so I was trying to fetch the MetaWeather API that's how I did it所以我试图获取 MetaWeather API 这就是我所做的

 fetch('https://crossorigin.me/https://www.metaweather.com/api/location/2487956/');
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Asynchronous JavaScript</title> </head> <body> <h1>Asynchronous JavaScript</h1> </body> </html>

I get those two errors and I really don't understand why.我收到这两个错误,我真的不明白为什么。

asynchronous.html:101 GET https://crossorigin.me/https://www.metaweather.com/api/location/2487956/ net::ERR_CONNECTION_RESET (anonymous) @ asynchronous.html:101 asynchronous.html:1 Uncaught (in promise) TypeError: Failed to fetch asynchronous.html:101 GET https://crossorigin.me/https://www.metaweather.com/api/location/2487956/net::ERR_CONNECTION_RESET (匿名)@asynchronous.html:101 asynchronous.html:1 Uncaught (承诺)类型错误:无法获取

Try to place the url succeeding this proxy: https://cors-anywhere.herokuapp.com/ instead of https://crossorigin.me/尝试将 url 放在此代理之后: https : //cors-anywhere.herokuapp.com/而不是https://crossorigin.me/

It worked for me.它对我有用。

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

相关问题 net :: ERR_EMPTY_RESPONSE &amp;&amp;未捕获(承诺中)TypeError:无法获取 - net::ERR_EMPTY_RESPONSE && Uncaught (in promise) TypeError: Failed to fetch 无法加载资源:net::ERR_CONNECTION_RESET in angular - Failed to load resource: net::ERR_CONNECTION_RESET in angular 无法加载资源:net::ERR_FILE_NOT_FOUND,未捕获(承诺中)类型错误:无法获取 - Failed to load resource: net::ERR_FILE_NOT_FOUND, Uncaught (in promise) TypeError: Failed to fetch 随机net :: ERR_CONNECTION_RESET问题 - Random net::ERR_CONNECTION_RESET issues net :: ERR_CONNECTION_RESET与Tomcat 6 - net::ERR_CONNECTION_RESET with Tomcat 6 jQuery:.net::ERR_CONNECTION_RESET - jQuery: net::ERR_CONNECTION_RESET Javascript try-catch无法捕获“无法加载资源:net :: ERR_CONNECTION_RESET” - Javascript try-catch doesn't catch 'Failed to load resource: net::ERR_CONNECTION_RESET ' 无法加载资源:net :: ERR_CONNECTION_RESET node js server - Failed to load resource: net::ERR_CONNECTION_RESET node js server Django 通道失败:WebSocket 握手期间出错:net::ERR_CONNECTION_RESET - Django Channels failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET JavaScript获取请求错误:无法加载资源:net :: ERR_CONNECTION_RESET - JavaScript get request error: Failed to load resource: net::ERR_CONNECTION_RESET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM