'Cannot make http call on device

I couldn't get http api call working on the device. Cors is blocking it. I tried native http error as described in the link below but i am getting weird errors.

https://ionicframework.com/docs/native/http/

2021-04-20 00:07:58.221 13452-13555/io.ionic.starter E/Capacitor/Plugin: Error 2021-04-20 00:07:58.221 13452-13555/io.ionic.starter D/Capacitor: Sending plugin error: {"save":false,"callbackId":"27025047","pluginId":"Http","methodName":"request","success":false,"error":{"message":"Error"}} 2021-04-20 00:07:58.249 13452-13452/io.ionic.starter I/Capacitor/Console: File: http://localhost/default~tab1-tab1-module~tab2-tab2-module~tab3-tab3-module~tab4-tab4-module.js - Line 523 - Msg: Error: Error 2021-04-20 00:07:58.250 13452-13452/io.ionic.starter I/Capacitor/Console: File: 2021-04-20 00:07:58.261 13452-13452/io.ionic.starter E/Capacitor/Console: File: http://localhost/vendor.js - Line 59237 - Msg: ERROR [object Object]



Solution 1:[1]

I realized Simulator didnt have the internet enabled.After enabling it, HTTP call worked

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Olcay Tarazan