Hi there,
I’m using fetch to reach my APIs, somehow testing on my dev server and production are producing totally different results, i need to see the HTTP requests.
I’ve tried:
XMLHttpRequest = GLOBAL.originalXMLHttpRequest ?
GLOBAL.originalXMLHttpRequest : GLOBAL.XMLHttpRequest;
but that now produces the “unsupported bodyinit type” error.
Then i tried using postman with a proxy setup on my iPhone.
But that only shows the traffic between my phone and expo XDE, i want to see the traffic between the phone and my production site. However i found after using the proxy, the requests are being ignored/blocked?
How do you guys do it?
My actual problem:
Im using CodeIgniter as my API endpoint.
I have 2 endpoints, they both work fine in my development server.
On the production, one works fine while the other doesnt:
This returns a 404, “The specified URL cannot be found”
return fetch(API_URL + 'getEvent', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
signature: generateKey(token),
eToken: token
})
})
.then(response => {
console.log('Fetch event response');
console.log(response.text());
// if (response.ok) {
return response.json();
// } else {
// }
})
This one works fine, can update my db and returns 200:
return fetch(API_URL + 'checkInOutMany', {
method: 'POST',
header: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
signature: generateKey(token),
participants: toSync,
eToken: token
})
})
.then(response => {
console.log('Syncing response');
console.log(response);
// if (response.ok) {
return response.json();
// } else {
// }
})
I don’t even see a difference.
Any ideas?