Skip to content

Commit bc57e02

Browse files
authored
Fix Rack LintError from uppercase response headers for client_dev (#628)
* Fix Rack LintError from uppercase response headers for client_dev * Add changelog entry
1 parent aa0480f commit bc57e02

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- [BREAKING CHANGE] Ruby version 3.1.0 or later is required. [#632](https://github.com/MiniProfiler/rack-mini-profiler/pull/632)
6+
- [FIX] Lower case HTTP response headers to be compatible with Rack 3 [#628](https://github.com/MiniProfiler/rack-mini-profiler/pull/628)
67
- [FIX] Truncate long profiler name in profiler popup. [#634](https://github.com/MiniProfiler/rack-mini-profiler/pull/634)
78
- [FIX] `flamegraph_mode` query param having no effect. [#635](https://github.com/MiniProfiler/rack-mini-profiler/pull/635)
89
- [FEATURE] Show record type and count in SQL query UI. [#638](https://github.com/MiniProfiler/rack-mini-profiler/pull/638)

lib/mini_profiler/actions.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Actions
55
def serve_snapshot(env)
66
MiniProfiler.authorize_request
77
status = 200
8-
headers = { 'Content-Type' => 'text/html' }
8+
headers = { 'content-type' => 'text/html' }
99
qp = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
1010
if group_name = qp["group_name"]
1111
list = @storage.snapshots_group(group_name)
@@ -56,9 +56,9 @@ def serve_file(env, file_name:)
5656
resources_env['PATH_INFO'] = file_name
5757

5858
if Gem::Version.new(Rack.release) >= Gem::Version.new("2.1.0")
59-
rack_file = Rack::Files.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
59+
rack_file = Rack::Files.new(resources_root, 'cache-control' => "max-age=#{cache_control_value}")
6060
else
61-
rack_file = Rack::File.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
61+
rack_file = Rack::File.new(resources_root, 'cache-control' => "max-age=#{cache_control_value}")
6262
end
6363

6464
rack_file.call(resources_env)
@@ -93,11 +93,11 @@ def serve_results(env)
9393
# If we're an XMLHttpRequest, serve up the contents as JSON
9494
if request.xhr?
9595
result_json = page_struct.to_json
96-
[200, { 'Content-Type' => 'application/json' }, [result_json]]
96+
[200, { 'content-type' => 'application/json' }, [result_json]]
9797
else
9898
# Otherwise give the HTML back
9999
html = generate_html(page_struct, env)
100-
[200, { 'Content-Type' => 'text/html' }, [html]]
100+
[200, { 'content-type' => 'text/html' }, [html]]
101101
end
102102
end
103103

lib/mini_profiler/views.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def make_link(postfix, env)
110110
end
111111

112112
def flamegraph(graph, path, env)
113-
headers = { 'Content-Type' => 'text/html' }
113+
headers = { 'content-type' => 'text/html' }
114114
iframe_src = "#{public_base_path(env)}speedscope/index.html"
115115
html = <<~HTML
116116
<!DOCTYPE html>
@@ -141,7 +141,7 @@ def flamegraph(graph, path, env)
141141
end
142142

143143
def help(client_settings, env)
144-
headers = { 'Content-Type' => 'text/html' }
144+
headers = { 'content-type' => 'text/html' }
145145
html = <<~HTML
146146
<!DOCTYPE html>
147147
<html>

0 commit comments

Comments
 (0)