CordovaHTTP plugin error basicAuth


#1

Hi!, i’m work in a ionic project using cordovaHTTP plugin. The fact is i need to authenticate a server after to make request. when i call the method “useBasicAuth” this error was displayed

TypeError: Cannot set property 'Authorization' of undefined
    at Object.http.useBasicAuth (file:///android_asset/www/plugins/cordova-plugin-http/www/cordovaHTTP.js:36:36)

This method on cordovaHTTP :

 useBasicAuth: function(username, password) {
        this.headers.Authorization = 'Basic ' + b64EncodeUnicode(username + ':' + password);
    },

It’s seems like the object “this.headers” is null… any solution?