Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

superagent dynamic method types

I'm using superagent and I faced a problem with dynamic method name. For every method I shoud write:

request
  .get(url)

request
  .post(url)

Is there any way to pass method name as parameter to superagent like that done in axios

 axios({
  method: 'post',
  url,
  data
});
like image 479
ivankoleda Avatar asked Mar 13 '26 06:03

ivankoleda


1 Answers

You can also use like below check docs

request('GET', url).end(callback);// and pass your first param as http verb 'GET','POST', etc...

Instead just

request.get(url);

Or

request.post(url);
like image 116
Niklesh Raut Avatar answered Mar 14 '26 18:03

Niklesh Raut



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!