strongloop / strong-remoting

Communicate between objects in servers, mobile apps, and other servers.
www.strongloop.com
Other
105 stars 93 forks source link

Fix support for hooks returning a Promise #363

Closed bajtos closed 8 years ago

bajtos commented 8 years ago

Fix the code to correctly recurse and invoke next hooks after the promise returned by the first hook callback was resolved.

The issue was discovered by @tvdstaaij in https://github.com/strongloop/loopback/pull/2751

@gunjpan @richardpringle or @deepakrkris please review

bajtos commented 8 years ago

Before the fix, the modified unit-test was failing with the following error:

  1) strong-remoting-rest call of prototype method should resolve promise returned by a hook:

      Uncaught AssertionError: expected [ 'first' ] to deeply equal [ 'first', 'second' ]
      + expected - actual

       [
         "first"
      +  "second"
       ]
gunjpan commented 8 years ago

LGTM