angular - 发出打开天气 api 的 http 请求时出现未知错误
问题描述
我在我的 stckblitz 项目中进行了 http 调用
http://api.openweathermap.org/data/2.5/weather?q=' + data.city + '&appid=' + this.APIKey
但它总是给出一个错误
Http failure response for http://api.openweathermap.org/data/2.5/weather?q=london&appid=6492527f849e5034d485df6b5981d407: 0 Unknown Error
解决方案
您应该使用https
url 的版本:
https://api.openweathermap.org/data/2.5/weather?q=' + data.city + '&appid=' + this.APIKey
推荐阅读
- security - 我可以检查整个网站的完整性吗?
- javascript - 仅电子打印到 pdf 选择
- node.js - 在 Docker 根用户问题中使用 puppeteer 进行 Apify
- bash - 将源目录复制到作为目录符号链接的目标中
- java - 如何在 Java 中声明一个洗牌的方法?
- r - 如何抓取包含在 R 中链接的子链接中的文本?
- c++ - g++ 是否优化 x / 2^n 乘法?
- azure - Azure 数据工厂将活动 csv 复制到 cosmosdb 失败
- laravel - Laravel/Vue 图片上传 i-viewUI
- sql - 如何提取过去 30 天的数据?