grover 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa11dd4c983b7d122791e035286bc18f9fdda40561f0102547b801aa4718013c
4
- data.tar.gz: 77fb1776461acc88789f1405e4c3135b9857971116880239671f3302d4df0505
3
+ metadata.gz: 3bf608ae368489f3130cc1af42bffa5026d9d14c1a7aa1ca1534dbd085fe6c0c
4
+ data.tar.gz: 8dc8da4dd66e8b08a64514dc6497e5afb1179cd3c657a40597abb29f7573c9fd
5
5
  SHA512:
6
- metadata.gz: d0e3ae26db5e6934bdb257c465001ac46f15404e201c1d5a431e96f03c36c4b27b1e10920337e0f67d4d012da55d9c651868b0497f20832ae191bb42eba29243
7
- data.tar.gz: 5b9baa164d1fdb46b8a71dec29d68471622e9bd829742fee6975c19f2d2fc5b8a51b1f120f8ccebe7ee9ccfc1f38ed291881cb00998b7b72a90ae41bb0bd23d3
6
+ metadata.gz: a508fe62248fd9404e3240128f258d7b5d9d1dbcf3f747181366a50e0025fd4f46f52cade1d70083558b77d3cbb519fe16ed7cb1a00c914f2a014d3ecb3a74a3
7
+ data.tar.gz: 29799af91ca664634ba205fed874f8f4fb2a19b6930780f68d5a8eae43337b1cefa5c5af5b104c294b026be7e71347b990e873935d9c9a1a34c61eb5f0c335ae
@@ -85,7 +85,7 @@ class Grover
85
85
  end
86
86
 
87
87
  def html_content?(headers)
88
- headers['content-type'] =~ %r{text/html|application/xhtml\+xml}
88
+ headers[lower_case_headers? ? 'content-type' : 'Content-Type'] =~ %r{text/html|application/xhtml\+xml}
89
89
  end
90
90
 
91
91
  def update_response(response, headers)
@@ -155,11 +155,12 @@ class Grover
155
155
 
156
156
  def assign_headers(headers, body, content_type)
157
157
  # Do not cache results
158
- headers.delete 'etag'
159
- headers.delete 'cache-control'
158
+ headers.delete(lower_case_headers? ? 'etag' : 'ETag')
159
+ headers.delete(lower_case_headers? ? 'cache-control' : 'Cache-Control')
160
160
 
161
- headers['content-length'] = (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s
162
- headers['content-type'] = content_type
161
+ headers[lower_case_headers? ? 'content-length' : 'Content-Length'] =
162
+ (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s
163
+ headers[lower_case_headers? ? 'content-type' : 'Content-Type'] = content_type
163
164
  end
164
165
 
165
166
  def configure_env_for_grover_request(env)
@@ -223,5 +224,11 @@ class Grover
223
224
  env.delete 'CONTENT_LENGTH'
224
225
  env.delete 'RAW_POST_DATA'
225
226
  end
227
+
228
+ def lower_case_headers?
229
+ return @lower_case_headers if defined? @lower_case_headers
230
+
231
+ @lower_case_headers = Gem::Version.new(Rack.release) >= Gem::Version.new('3')
232
+ end
226
233
  end
227
234
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '1.2.2'
4
+ VERSION = '1.2.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-13 00:00:00.000000000 Z
11
+ date: 2025-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri