fastify / fastify-reply-from

fastify plugin to forward the current http request to another server
MIT License
148 stars 76 forks source link

add/custom-retry-handlers #331

Closed MikePresman closed 10 months ago

MikePresman commented 10 months ago

This PR implements a rework of the retry API to succicently handle custom retry callbacks passed to .from(). The API is extended in such a way that the custom retry handler function passed to .from() has an option to either invoke the default retry handler or skip it completely. That is, currently retries on 503's work out of the box with this library but if you add a custom retry handler it is your responsibility to register that default handler otherwise 503's won't be handled.

The purpose and motivation of this PR was to handle custom retries (duh) but more importantly 500's. As a result the test suite for this PR is in respect to 500 errors.