I'm using the "react-native-ssl-pinning" to pin requests on iOS. The POST requests succeeds, but the GET requests fail because the headers do not reach the server. (The server complaints that the authorization tokens are missing.) But the same code runs fine on Android
The same code/module runs fine for GET and POST requests on Android
function fetch(URL, method, data) {
let fullURL = ApiEndpoint.BASE_URL + URL
let headers = {
'Content-Type': "application/json",
Accept: "application/json",
'unique-id': '<sample-id>',
'userId': '<sample>',
'username': getUsername(),
'jwt-token': getAuthToken(),
}
let promise = new Promise((resolve, reject) => {
let fetchParams = {
method: method,
timeoutInterval: 20000,
headers: headers,
}
if (method == Method.POST) {
fetchParams.body = JSON.stringify(data)
}
fetch(fullURL, fetchParams).then(response => {
let responseBody = JSON.parse(response.bodyString)
resolve({ ...response, data: responseBody })
})
.catch(err => {
let response = { ...err }
reject(response)
})
})
return (() => promise)
}
The GET requests should send the headers to the server.