Native HTTP plugin error

Hi there,
I have been trying to get an API to work along with my ionic (V4) app with no luck.
I have tried using Http and HttpClient provided by angular but it raised some errors and after a quick look on the internet, it seemed like this was an error related to CORS. Before you ask, I didn’t run the app through ionic serve -c but I ran ionic cordova build ios and ran the app on my iPhone from Xcode.
Now I’m trying to use the Native HTTP plugin but I get an error that I can’t find a solution for. I will be glad to get some answers (app due to this Sunday :scream:

My error (as shown in Safari Web Inspector):


When I click the js file link I get this function:

function checkKeyValuePairObject(obj, allowedChildren, onInvalidValueMessage) {
    if (getTypeOf(obj) !== 'Object') {
      throw new Error(onInvalidValueMessage);

    var keys = Object.keys(obj);

    for (var i = 0; i < keys.length; i++) {
      if (allowedChildren.indexOf(getTypeOf(obj[keys[i]])) === -1) {
        throw new Error(onInvalidValueMessage); <== line 67

    return obj;

Thank you for answers.

1 Like

Did you fix this? I am currently stuck here as well… due last week!

I have the exact same error. Did you guys find a solution?

I found the error! I was setting the headers to
{ headers: { 'Content-Type':'application/json'} }
instead of
{ 'Content-Type':'application/json'}

Hope it helps.