r-lib / httr2

Make HTTP requests and process their responses. A modern reimagining of httr.
https://httr2.r-lib.org
Other
238 stars 59 forks source link

feature request: `req_perform_promise()` #501

Closed gergness closed 3 months ago

gergness commented 3 months ago

It's nice that parallelization is possible through req_perform_multi() but I wish there was a way that httr2 wouldn't have to hold onto control while the requests are being made. (For example, a shiny dashboard where each tile could load independently even if each depended on a httr2 request).

Playing around a bit, I was pleasantly surprised how easy it was to extend the internal Performance class to get a promise, based on the way the promises package wraps future objects (with a later loop), but that class isn't exported. Would you consider a PR that adds this? Or if not, exporting the Performance object?

hadley commented 3 months ago

I'd love to see a PR for this 😄