扑来 - 我可以向EC2集成环境端点提出请求
我无法通过颤动向AWS实例端点提出请求。随着代码在请求中停止时,下面的行甚至都没有执行。
Future getCode() async {
Response response = await client.get(
Uri.parse('http://ec2-54-202-27-94.sa-east-1.compute.amazonaws.com/test/api/v1/example'),
);
print(response.statusCode);
}
我能够通过Postman执行相同的请求。
但是,当我通过颤动向相同端点提出请求,更改域的第一部分(提出生产环境而不是对同类的要求)时,它有效:
集成URL(不起作用)
http://ec2-54-202-27-94.sa-east-1.compute.amazonaws.com/test/api/v1/example
http://www.test.com/test.com/test/api/api/api/api/v1/example
我还强调,集成环境是生产环境的副本,应该可以访问两者。
我相信,没有必要对接收这些请求的服务器进行任何更改,因为我可以通过Postman成功提出请求。
我如何通过颤音提出此请求
I can't make a request to an AWS instance endpoint through Flutter. The line below is not even executed, as the code stops on the request.
Future getCode() async {
Response response = await client.get(
Uri.parse('http://ec2-54-202-27-94.sa-east-1.compute.amazonaws.com/test/api/v1/example'),
);
print(response.statusCode);
}
I am able to perform this same request through Postman.
However, when I make a request via Flutter to the same endpoint, changing the first part of the domain (making the request for the Production environment and not for Homologation), it works:
Integration URL (does not work in Flutter)
http://ec2-54-202-27-94.sa-east-1.compute.amazonaws.com/test/api/v1/example
Production URL (works in Flutter)
I also emphasize that the integration environment is a copy of the production environment, which should allow access to both.
I believe that it is not necessary to make any changes to the server that receives these requests, as I can successfully make the request through Postman.
How can I make this request through Flutter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它可以通过调用集成环境的端池来工作,
为此,它有必要使用BadCertificateCallback并指定我想允许访问的证书。我创建了一个指定此内容的类:
添加以下行
在具有主函数的项目文件中,以这种方式
:不适合在生产环境中使用不安全的证书。仅在调试模式下使用
It worked for the request to work by calling the endpont of the integration environment
For this it was necessary to use the badCertificateCallback and specify the certificate that I would like to allow access. I created a class specifying this:
And in the project file that has the main function, add the following lines
This way:
It is not appropriate to allow the use of insecure certificates in a production environment. Use only in Debug mode