0
NPMリクエストライブラリを使用して、ヘッダーとフォームを渡すAPI呼び出しを行っています。私は、APIの呼び出しは正常に働いていたが、できるだけ早くAPIのヘッダはそれを呼び出す追加として、次のエラーを示しているだけFORMDATAたかった時刻まで: - :API呼び出し中にエラーが発生する
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){
}
})
},
-
" Failed to construct 'Headers': Please use the 'new' operator.... "
ここでは私のAPIの呼び出しです
があなたはJSONオブジェクトとして簡単なようヘッダを渡すことができますが、形式は次のようにする必要があります: