serviejs / popsicle

Simple HTTP requests for node and the browser
MIT License
246 stars 19 forks source link

Adding 'finally' to popsicle promise #81

Closed jeremyrambo closed 7 years ago

jeremyrambo commented 7 years ago

Have you considered adding a finally notation to the popsicle promise?

E.g.

popsicle.get('/users')
  .then(function (res) {
    // Success!
  })
  .catch(function (err) {
    // Something broke.
  })
  .finally(function (err) {
    // Something to happen regardless of success or failure.
  })
blakeembrey commented 7 years ago

It's not part of the specification, so no. You can use a library for that, like https://github.com/blakeembrey/promise-finally.