Closed thhermansen closed 7 years ago
This pull request filters the URL logged, but it uses the URL (with sensitive URL params) as cache key.
Maybe a more correct fix is to only use URL with sensitive data when doing a request to Google's API, but as cache key and when logging we'll use the filtered one.
What do you think, @aceunreal?
I think I'll push the code in the direction where we have a sensitive_url
and a filtered_url
from the UrlBuilder
class., thus remove the responsibility of filtering the URL from the log subscriber.
Maybe we we could hash the sensitive_url
when we add it to the cache as well, instead of use the filtered_url
as hash key, as people may want to filter params which should be included as cache key.
This fixes an issue where filtering the URL actually mutated the given URL string. That string was also used as a cache key, but it didn't hit the cache as the string was mutated.
Fixes https://github.com/Skalar/google_distance_matrix/issues/32
PS. There are
somea lot of rubocop related changes in this pull request as well as the fix. Sorry for that, but I didn't spend time keeping the rubocop commits separate from the fix.