Should node-red nodes use HTTP request() or got()?

In the few Node-RED nodes that I've created that wrap an API, I've been using request to make HTTP request calls. I wonder if I should switch the nodes to use got ? Or axios?

I converted one of my node-red packages from request() to got().
It executes essentially the same but I didn't run any performance tests.

Downside would be that my nodes would require node.js v8 or higher.

I did a quick unscientific survey on my system - limited by the nodes that I have installed on my Linux system.

$ locate node_modules/request/request.js | grep node-red | wc -l
$ locate node_modules/got/index.js | grep node-red | wc -l
$ locate node_modules/axios/index.js | grep node-red | wc -l

Any recommendations?
-- John

Axios has more stars and forks than all of them but request is most common


Good analysis here...

1 Like

The request module is now deprecated and will no longer be receiving any fixes.

No new code should be written using request and an alternative should be picked.

There are lots of candidates. The got module provides this comparison chart that, perhaps unsurprisingly, puts got ahead of the others -

I don't have a strong opinion about it yet, but we do have an open issue to migrate the core HTTP Request node to something:

If anyone in the community wanted to find a way to start contributing, this would be very welcome first issue to tackle.... The hard part is ensuring 100% compatibility with the node's current behaviour with the request module. Just let us know before you start playing with it.

Thanks for the articles. Those links are what kicked me into thinking about migrating. I've converted my Node-RED nodes to use got for network requests. I compared several examples and read some of the documentation. got was much easier to implement than axios in my relatively simple use case.
-- John

:slight_smile: - great - if you feel like helping to update any of the project node-red-nodes or node-red-web-nodes please feel free.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.