I am trying to make an http request from nativescript to a regular http (not https) server.
let headers = new Headers();
headers.append("Content-Type", "application/json");
this.http.request(
"http://localhost:3050/register",
{
method: "POST",
headers: headers,
body: JSON.stringify({
username: user.username,
email: user.email,
password: user.password
})
})
The request worked perfectly when made to an https server, but when made to an http server (which is the server I am currently running), it wouldn't work.
In iOS, I had to add the following in the info.plist file in order to allow the request to the http server, and after that it worked fine:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
However, in Android, the request is still not working, and I cannot find any documentation about changes I need to make in order to get the request working to an http server. The request is not even hitting the server.
Any help is appreciated.
Thanks.