lostisland / faraday_middleware

Various Faraday middlewares for Faraday-based API wrappers
MIT License
556 stars 205 forks source link

Allow users to define its own set of Cacheable Status Code when using Faraday Middleware Cache #275

Closed Physium closed 2 years ago

Physium commented 2 years ago

This implementation allows users to define its own set of status codes for caching as opposed to sticking to a set of predefined CACHEABLE_STATUS_CODE constant. Nonetheless, user defined status code has to be within the list of predefined CACHEABLE_STATUS_CODE constant.

iMacTia commented 2 years ago

Thank you @olleolleolle, that's a great suggestion! @Physium while you make that change, could you please also rename the new option to plural so that it's @options[:status_codes]? It's shorter and it looks nicer when adding the middleware. I think that will help remove confusion between the option and the CACHEABLE_STATUS_CODES constant. (remember to update the initialize documentation after this change)