sprockets 4.1.0 → 4.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd427dc138e916f8edb7b07dd2139da83fa2cad386de0321eeb8dc668cbfc57f
4
- data.tar.gz: 176fe20e253fde5bd04945f29de4aef9720e77480e2a6f9ef3353fe17bd5b61f
3
+ metadata.gz: e5f1a2b7d847a15dff3669ec28a2248484ee0831c88017fc67fee6afe7b6a6f1
4
+ data.tar.gz: 2714999cde7d9f9340d0d7f2a98f3e48c9b46d099e36069dd380a12f6c270c54
5
5
  SHA512:
6
- metadata.gz: a84a1038484ba2649a87f2db4b53f1737b3b38fcd26c22cca5402a9ccb48d6ba3051e59b84e04ef09efcb7bb625cd3a2ecebd51be0c2b46e4950c549d7eb3ea1
7
- data.tar.gz: d99e8c141117d55f7c10fa8b687f5acb7090f6dd1d7a39f0e2443f2bca8dc6af0d5a00cf9f42f137c3dda9dffe722fc1ab4744a739ca013f8549341c8d759444
6
+ metadata.gz: db948451245c6a7e6cf20876368d040e6de9b3f178ab5fa0010070b9e834cd08036d449e35f3857a8443ac26fc5318ac20ab5cc16d91a4b65d8fc0f07a796939
7
+ data.tar.gz: 2a6e4b9dbb1f2effa1ef15a4f861c7b5cadb6384713bf3452749f8f0be1405ab319d85b23272b1dbc3bdeda7837d0ce55f0caf62273e197eb6190511f0789097
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md
4
4
 
5
+ - Fix `Sprockets::Server` to return response headers to compatible with with Rack::Lint 2.0.
6
+
5
7
  ## 4.1.0
6
8
 
7
9
  - Allow age to be altered in asset:clean rake task.
@@ -148,39 +148,39 @@ module Sprockets
148
148
  # Returns a 400 Forbidden response tuple
149
149
  def bad_request_response(env)
150
150
  if head_request?(env)
151
- [ 400, { "content-type" => "text/plain", "content-length" => "0" }, [] ]
151
+ [ 400, { "Content-Type" => "text/plain", "Content-Length" => "0" }, [] ]
152
152
  else
153
- [ 400, { "content-type" => "text/plain", "content-length" => "11" }, [ "Bad Request" ] ]
153
+ [ 400, { "Content-Type" => "text/plain", "Content-Length" => "11" }, [ "Bad Request" ] ]
154
154
  end
155
155
  end
156
156
 
157
157
  # Returns a 403 Forbidden response tuple
158
158
  def forbidden_response(env)
159
159
  if head_request?(env)
160
- [ 403, { "content-type" => "text/plain", "content-length" => "0" }, [] ]
160
+ [ 403, { "Content-Type" => "text/plain", "Content-Length" => "0" }, [] ]
161
161
  else
162
- [ 403, { "content-type" => "text/plain", "content-length" => "9" }, [ "Forbidden" ] ]
162
+ [ 403, { "Content-Type" => "text/plain", "Content-Length" => "9" }, [ "Forbidden" ] ]
163
163
  end
164
164
  end
165
165
 
166
166
  # Returns a 404 Not Found response tuple
167
167
  def not_found_response(env)
168
168
  if head_request?(env)
169
- [ 404, { "content-type" => "text/plain", "content-length" => "0", "x-cascade" => "pass" }, [] ]
169
+ [ 404, { "Content-Type" => "text/plain", "Content-Length" => "0", "X-Cascade" => "pass" }, [] ]
170
170
  else
171
- [ 404, { "content-type" => "text/plain", "content-length" => "9", "x-cascade" => "pass" }, [ "Not found" ] ]
171
+ [ 404, { "Content-Type" => "text/plain", "Content-Length" => "9", "X-Cascade" => "pass" }, [ "Not found" ] ]
172
172
  end
173
173
  end
174
174
 
175
175
  def method_not_allowed_response
176
- [ 405, { "content-type" => "text/plain", "content-length" => "18" }, [ "Method Not Allowed" ] ]
176
+ [ 405, { "Content-Type" => "text/plain", "Content-Length" => "18" }, [ "Method Not Allowed" ] ]
177
177
  end
178
178
 
179
179
  def precondition_failed_response(env)
180
180
  if head_request?(env)
181
- [ 412, { "content-type" => "text/plain", "content-length" => "0", "x-cascade" => "pass" }, [] ]
181
+ [ 412, { "Content-Type" => "text/plain", "Content-Length" => "0", "X-Cascade" => "pass" }, [] ]
182
182
  else
183
- [ 412, { "content-type" => "text/plain", "content-length" => "19", "x-cascade" => "pass" }, [ "Precondition Failed" ] ]
183
+ [ 412, { "Content-Type" => "text/plain", "Content-Length" => "19", "X-Cascade" => "pass" }, [ "Precondition Failed" ] ]
184
184
  end
185
185
  end
186
186
 
@@ -189,7 +189,7 @@ module Sprockets
189
189
  def javascript_exception_response(exception)
190
190
  err = "#{exception.class.name}: #{exception.message}\n (in #{exception.backtrace[0]})"
191
191
  body = "throw Error(#{err.inspect})"
192
- [ 200, { "content-type" => "application/javascript", "content-length" => body.bytesize.to_s }, [ body ] ]
192
+ [ 200, { "Content-Type" => "application/javascript", "Content-Length" => body.bytesize.to_s }, [ body ] ]
193
193
  end
194
194
 
195
195
  # Returns a CSS response that hides all elements on the page and
@@ -242,7 +242,7 @@ module Sprockets
242
242
  }
243
243
  CSS
244
244
 
245
- [ 200, { "content-type" => "text/css; charset=utf-8", "content-length" => body.bytesize.to_s }, [ body ] ]
245
+ [ 200, { "Content-Type" => "text/css; charset=utf-8", "Content-Length" => body.bytesize.to_s }, [ body ] ]
246
246
  end
247
247
 
248
248
  # Escape special characters for use inside a CSS content("...") string
@@ -258,18 +258,18 @@ module Sprockets
258
258
  headers = {}
259
259
 
260
260
  # Set caching headers
261
- headers["cache-control"] = +"public"
262
- headers["etag"] = %("#{etag}")
261
+ headers["Cache-Control"] = +"public"
262
+ headers["ETag"] = %("#{etag}")
263
263
 
264
264
  # If the request url contains a fingerprint, set a long
265
265
  # expires on the response
266
266
  if path_fingerprint(env["PATH_INFO"])
267
- headers["cache-control"] << ", max-age=31536000, immutable"
267
+ headers["Cache-Control"] << ", max-age=31536000, immutable"
268
268
 
269
269
  # Otherwise set `must-revalidate` since the asset could be modified.
270
270
  else
271
- headers["cache-control"] << ", must-revalidate"
272
- headers["vary"] = "Accept-Encoding"
271
+ headers["Cache-Control"] << ", must-revalidate"
272
+ headers["Vary"] = "Accept-Encoding"
273
273
  end
274
274
 
275
275
  headers
@@ -279,7 +279,7 @@ module Sprockets
279
279
  headers = {}
280
280
 
281
281
  # Set content length header
282
- headers["content-length"] = length.to_s
282
+ headers["Content-Length"] = length.to_s
283
283
 
284
284
  # Set content type header
285
285
  if type = asset.content_type
@@ -287,7 +287,7 @@ module Sprockets
287
287
  if type.start_with?("text/") && asset.charset
288
288
  type += "; charset=#{asset.charset}"
289
289
  end
290
- headers["content-type"] = type
290
+ headers["Content-Type"] = type
291
291
  end
292
292
 
293
293
  headers.merge(cache_headers(env, asset.etag))
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Sprockets
3
- VERSION = "4.1.0"
3
+ VERSION = "4.1.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-06-24 00:00:00.000000000 Z
12
+ date: 2022-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack