3

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
});
ivankoleda
  • 340
  • 1
  • 11

1 Answers1

4

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);
Niklesh Raut
  • 34,013
  • 16
  • 75
  • 109