I am using the NPM Request library to make an API call in which I want to pass Header as well as form. Until the time I wanted only formdata the API call was working fine but as soon as added the header in the API call it is showing the following error:-
" Failed to construct 'Headers': Please use the 'new' operator.... "
Here Is My API call:-
send:function(endpoint,callback, token, formdata, component){
this._request.post(endpoint, Headers : { Authorization :token
}, {form: formdata},function (error, response, body) {
if (!error && response.statusCode == 200) {
callback(response.body, component);
}else if(!error && response.statusCode == 400){
}
})
},