(颤振)HTTPClient无效参数:未在URI中指定主机 [英] (Flutter) HTTPClient Invalid argument(s): No host specified in URI

查看:189
本文介绍了(颤振)HTTPClient无效参数:未在URI中指定主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前正在开发一个小应用程序,该应用程序允许用户查看存储在Heroku中的数据库,但是在使用数据库URL".herokuapp.com/api/"时,我遇到了上述问题.

Currently working on a little app that allows users to view a database stored on Heroku, however I am running into the aforementioned issue when using the database's URL: ".herokuapp.com/api/".

var client = createHttpClient();
var response = await client.read('<example>.herokuapp.com/api/<data>');
List data = JSON.decode(response);

Heroku似乎没有使用HTTP(S)或www,我认为后者是个问题.

Heroku doesn't seem to use HTTP(S) nor www, the latter of which I believe to be the issue.

有人知道我如何绕过或解决此问题?

Does anyone know how I can bypass or resolve this issue?

推荐答案

我知道这是一个老问题,但是我偶然发现了这个问题,并通过在URL前面添加"http://"来解决了这个问题.

I know this is an old problem but I just stumbled into this problem and fixed it by adding an "http://" before the URL.

这篇关于(颤振)HTTPClient无效参数:未在URI中指定主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆