sourcelevel / faraday-http-cache

A Faraday middleware that respects HTTP cache
Other
343 stars 86 forks source link

[BaseStrategy] require 'logger' #131

Closed NickLaMuro closed 2 years ago

NickLaMuro commented 2 years ago

Prior to v2.4.0, a Logger was never actually specifically used in faraday-http-cache. But with the introduction of the ByVary strategy (and BaseStrategy class by proxy), the Logger was defaulted as the value for the :logger value (previously this was allowed to be nil)

This isn't a problem in CI for two reasons:

However, when using faraday-v1.0.1 (or probably other v1 versions), and commenting out the require 'active_support lines in the spec_helper.rb, the following error occurs:

NameError: uninitialized constant Faraday::HttpCache::Strategies::BaseStrategy::Logger

Since it seems like including a default logger was by design, just requiring the Logger lib by default in the class will ensure it is available in situations where it hasn't been required already on instance initialization of BaseStrategy and it's children.