Skip to content

Commit 470c9a8

Browse files
Requests page fails due to trying to modify a frozen string. (#630)
* Inserting into frozen string fails. Frozen strings cannot have `#insert` called on them, this was causing an error on the requests page. * Only dup blank page * Spec actually was incorrect: we werent inserting the script tag! --------- Co-authored-by: Nate Berkopec <[email protected]>
1 parent 1b42966 commit 470c9a8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/mini_profiler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def call(env)
329329
)
330330
end
331331
elsif path == '/rack-mini-profiler/requests'
332-
status, headers, body = [200, { 'Content-Type' => 'text/html' }, [blank_page_html]]
332+
status, headers, body = [200, { 'Content-Type' => 'text/html' }, [blank_page_html.dup]] # important to dup here!
333333
else
334334
status, headers, body = @app.call(env)
335335
end

spec/integration/middleware_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def app
2727
get '/rack-mini-profiler/requests', {}, 'HTTP_ACCEPT_ENCODING' => 'gzip, compress'
2828

2929
expect(last_response.body).to include('<title>Rack::MiniProfiler Requests</title>')
30-
expect(last_response.body).to match('<body>\n </body>')
30+
expect(last_response.body).to match('<body>\n <script async nonce="" type="text/javascript" id="mini-profiler"')
3131
end
3232
end
3333

0 commit comments

Comments
 (0)