jgraichen / restify

Restify is a experimental, parallel and pipelined Hypermedia API client
GNU Lesser General Public License v3.0
8 stars 2 forks source link

Fix promise resolution with empty array of deps #18

Closed franzliedke closed 5 years ago

franzliedke commented 5 years ago

When building a promise with a dynamic array of dependencies, this array can sometimes be empty. This behavior was currently not specified. We expect this promise to return an empty array, which would be consistent with the return value for multiple input dependencies (an array with one result per input promise).

There is one other case when this situation (no task, no dependencies) can happen: external promise resolution using a Writer object, e.g. through Restify::Promise.fulfilled. To differentiate these cases, we explicitly check for one or more empty arrays being passed in.