diff --git a/CHANGELOG.md b/CHANGELOG.md index fde8501d..2a5daaa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/mini_profiler/actions.rb b/lib/mini_profiler/actions.rb index f4b10251..c34fdd3d 100644 --- a/lib/mini_profiler/actions.rb +++ b/lib/mini_profiler/actions.rb @@ -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) @@ -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) @@ -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 diff --git a/lib/mini_profiler/views.rb b/lib/mini_profiler/views.rb index 5b987cfa..87566881 100644 --- a/lib/mini_profiler/views.rb +++ b/lib/mini_profiler/views.rb @@ -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 @@ -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