Ionic 如何发送请求到远程URL?

3zwjbxry  于 2022-12-09  发布在  Ionic
关注(0)|答案(1)|浏览(200)

我如何发送一个axios请求到正确的url?
我正在尝试从我的android离子React应用程序发出GET请求:

axios.get("192.168.178.88:8080/api/user/me")
    .then(response =>response.data)

我未从端点获得预期结果,并获得以下日志

D/Capacitor: Handling local request: http://localhost/
I/Gralloc4: mapper 4.x is not supported
W/Gralloc3: mapper 3.x is not supported
D/Capacitor: Handling local request: http://localhost/static/js/main.c1f587ce.js
D/Capacitor: Handling local request: http://localhost/192.168.178.88:8080/api/user/me

我希望并期望请求
http://192.168.178.88:8080/api/user/me
代替
本地192.168.178.88:8080/api/user/me

vjrehmav

vjrehmav1#

不要忘记将http添加到axios请求中的URL:

axios.get("http://192.168.178.88:8080/api/user/me")
        .then(response =>response.data)

相关问题