markelc
markelc

Reputation: 354

NativeScript Http Post Requests Blocked

Trying to send a post request via https in Angular/Nativescript. I have tried post requests to our api as well as public apis and they all fail. In fact they don't fail because they don't show any errors, they just don't get executed at all.

These post requests work in the Angular web app, and they work using Postman. It seems to be a problem with Nativescript or Android permission issue.

Upvotes: 1

Views: 1844

Answers (2)

markelc
markelc

Reputation: 354

It turns out the post request was working but I had a rxjs tap operator (useful in the web app) which caused an error in the subscription. Once I removed tap, the post request returned a valid response and valid observable.

Upvotes: 0

Osei Fortune
Osei Fortune

Reputation: 831

In apps targeting Android 9 or higher, the isCleartextTrafficPermitted() method returns false by default. If your app needs to enable cleartext for specific domains, you must explicitly set cleartextTrafficPermitted (android:usesCleartextTraffic="true") to true in your application tag in the AndroidManifest.xml located in your App_Resources directory

Upvotes: 6

Related Questions