cache_rules 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.16 (2015-04-29)
4
+
5
+ * Errors caused by empty HTTP headers. Fixes issue #8
6
+
3
7
  ## 0.1.15 (2015-04-29)
4
8
 
5
9
  * No max-stale = allow anything. Fixes issue #7
data/cache_rules.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'date'
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'cache_rules'
9
- s.version = '0.1.15'
9
+ s.version = '0.1.16'
10
10
 
11
11
  s.date = Date.today.to_s
12
12
 
data/lib/formatting.rb CHANGED
@@ -30,7 +30,7 @@ module CacheRules
30
30
  def clean
31
31
  ->(headers) {
32
32
  Array(headers).reject {|key, value|
33
- HEADERS_NO_CACHE.include?(key) || helper_is_if_modified_error?(key, value)
33
+ HEADERS_NO_CACHE.include?(key) || helper_is_if_modified_error?(key, value) || value.nil? || value.empty?
34
34
  }
35
35
  }
36
36
  end
@@ -35,4 +35,13 @@ class TestRegressions < MiniTest::Test
35
35
 
36
36
  assert_kind_of TrueClass, no_max_stale
37
37
  end
38
+
39
+ # https://github.com/aw/CacheRules/issues/8
40
+ def test_bugfix_8_errors_caused_by_empty_http_headers
41
+ isnil = CacheRules.clean.call({'Content-Type'=>nil})
42
+ isempty = CacheRules.clean.call({'Content-Type'=>''})
43
+
44
+ assert_equal isnil, []
45
+ assert_equal isempty, []
46
+ end
38
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: