Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

POST request returns data on Android but not iOS

$
0
0

I have a react native app that I am building for Android and iOS. It contains a POST request made to a URL hosted on a docker container containing an API.

The docker image is running on my windows machine. Same machine I use to develop the android app.I also have a MacBook that I am using to develop the iOS version of the app.

The request URL looks something like this: http://192.168.X.X:8081/get_profile?type=appleThe IP is the IP of my windows machine that is running the docker container.

The response on my windows machine is returned as follows when I make the request;

0�  *�H����0�10    `�He<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList- 1.0.dtd"><plist version="1.0">-----XML data further below------

I know I have an encoding issue at the start of the response but it's something.BUT on the macbook, I have the same exact code and yet it returns undefined.

I checked my info.plist to confirm it allows HTTP requests and I have tested it with another HTTP API which returns JSON data, and that worked without issues.

Request

fetch(this.state.fetchUrl, {  method: 'POST',  headers: new Headers({'Accept': 'application/x-apple-aspen-config','Content-Type': 'application/xml;',  }),  body: `<PerProviderSubscription xmlns="` + this.state.url + `"><HomeSP><FriendlyName>` + this.state.friendlyName + `</FriendlyName><FQDN>` + this.state.fqdn + `</FQDN><RoamingConsortiumOI>039393 004096</RoamingConsortiumOI></HomeSP><Credential><Realm>` + this.state.realm + `</Realm><UsernamePassword><Username>` + this.state.username + `</Username><Password>` + this.state.password + `</Password><EAPMethod><EAPType>` + this.state.eapType + `</EAPType><InnerMethod>` + this.state.innerMethod + `</InnerMethod></EAPMethod></UsernamePassword></Credential><AAAServerTrustChain><CertURL>` + this.state.certURL + `</CertURL><CertSHA256Fingerprint>` + this.state.fingerprint + `</CertSHA256Fingerprint></AAAServerTrustChain><Extensions /></PerProviderSubscription>`,})  .then((response) => response.text())  .then((data) => {    console.log('DATA: ', data);})

Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>