Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update block-ref to not make duplicate request (#151)
The goal of the `block-ref` middleware is to look for instances in request parameters where "latest" is being used as a block parameter and replace it with the actual latest block number (as reported by the block tracker). The middleware will then make a child request through the provider using the resolved parameters and copy the child response onto the final response object. That is fine; however, this middleware then calls the next middleware in the stack, which in practice will make another request, and that will end up overwriting the child response set in this middleware. That makes this middleware ineffective. So, this commit removes the `next()` call from the `block-ref` middleware so that when it takes effect it stops the chain and prevents an extra request. In addition, this fills in missing tests for the middleware.
- Loading branch information