user979879
user979879

Reputation: 93

How to send form data and header with delete request using request module in nodejs

I want to send form data which is coming from my angularjs form to nodejs and then I want to send these data from nodejs to my service API. But the data is not receiving at my service API. I cannot understand what was going wrong in this. Please help me to overcome this problem.

requestMethodDelete: function (url, form_data, header) {

    return new Promise((resolve, reject) => {

        console.log("FORM DATA IN DELETE REQUESST METHOD");
        console.log(form_data);

        //SET ALL THESE PARATMETER TO MAKE REQUEST
        request.delete({url: url, form: form_data, headers: header}, 
           function (error, response, body) {
                resolve(body);
            }
        });

    });
},

I want to send form data and header but couldn't receive at service API, please tell me what can I do for my expected result.

Upvotes: 0

Views: 328

Answers (1)

user979879
user979879

Reputation: 93

In request.delete function form option is not work for sending form_data. To sending form-data to our service api we need to use qs option rather than form option. that's it, it solved your problem also if you are facing the same problem which I was facing.

Upvotes: 1

Related Questions