local-ch / lhc

🚀 Advanced HTTP Client for Ruby. Fueled with interceptors.
GNU General Public License v3.0
43 stars 1 forks source link

Consider ignore_errors when retrying requests #164

Closed 10xSebastian closed 5 years ago

10xSebastian commented 5 years ago

PATCH

This PR makes the retry interceptor consider to not retry a request if the error (response) was explicitly ignored. (Which was expected to work that way.)

Retry Interceptor

Do not retry certain response codes

If you do not want to retry based on certain response codes, use retry in combination with explicit ignore_errors:

  LHC.get('http://local.ch', ignore_errors: [LHC::NotFound], retry: { max: 1 })

Or if you use LHC::Retry.all:

LHC.get('http://local.ch', ignore_errors: [LHC::NotFound])