Skip to content

Commit

Permalink
Fix Rack LintError from uppercase response headers for client_dev (#628)
Browse files Browse the repository at this point in the history
* Fix Rack LintError from uppercase response headers for client_dev

* Add changelog entry
  • Loading branch information
coalest authored Feb 11, 2025
1 parent aa0480f commit bc57e02
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- [BREAKING CHANGE] Ruby version 3.1.0 or later is required. [#632](https://github.com/MiniProfiler/rack-mini-profiler/pull/632)
- [FIX] Lower case HTTP response headers to be compatible with Rack 3 [#628](https://github.com/MiniProfiler/rack-mini-profiler/pull/628)
- [FIX] Truncate long profiler name in profiler popup. [#634](https://github.com/MiniProfiler/rack-mini-profiler/pull/634)
- [FIX] `flamegraph_mode` query param having no effect. [#635](https://github.com/MiniProfiler/rack-mini-profiler/pull/635)
- [FEATURE] Show record type and count in SQL query UI. [#638](https://github.com/MiniProfiler/rack-mini-profiler/pull/638)
Expand Down
10 changes: 5 additions & 5 deletions lib/mini_profiler/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Actions
def serve_snapshot(env)
MiniProfiler.authorize_request
status = 200
headers = { 'Content-Type' => 'text/html' }
headers = { 'content-type' => 'text/html' }
qp = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
if group_name = qp["group_name"]
list = @storage.snapshots_group(group_name)
Expand Down Expand Up @@ -56,9 +56,9 @@ def serve_file(env, file_name:)
resources_env['PATH_INFO'] = file_name

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

rack_file.call(resources_env)
Expand Down Expand Up @@ -93,11 +93,11 @@ def serve_results(env)
# If we're an XMLHttpRequest, serve up the contents as JSON
if request.xhr?
result_json = page_struct.to_json
[200, { 'Content-Type' => 'application/json' }, [result_json]]
[200, { 'content-type' => 'application/json' }, [result_json]]
else
# Otherwise give the HTML back
html = generate_html(page_struct, env)
[200, { 'Content-Type' => 'text/html' }, [html]]
[200, { 'content-type' => 'text/html' }, [html]]
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/mini_profiler/views.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def make_link(postfix, env)
end

def flamegraph(graph, path, env)
headers = { 'Content-Type' => 'text/html' }
headers = { 'content-type' => 'text/html' }
iframe_src = "#{public_base_path(env)}speedscope/index.html"
html = <<~HTML
<!DOCTYPE html>
Expand Down Expand Up @@ -141,7 +141,7 @@ def flamegraph(graph, path, env)
end

def help(client_settings, env)
headers = { 'Content-Type' => 'text/html' }
headers = { 'content-type' => 'text/html' }
html = <<~HTML
<!DOCTYPE html>
<html>
Expand Down

0 comments on commit bc57e02

Please sign in to comment.