-
Notifications
You must be signed in to change notification settings - Fork 423
Ensure compatibility with Rack 2.x and 3.x #653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,8 +12,12 @@ env: | |
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| name: Ruby ${{ matrix.ruby }} | ||
| name: Ruby ${{ matrix.ruby }} (Rack ~> ${{ matrix.rack }}) | ||
| services: | ||
| redis: | ||
| image: "redis" | ||
| ports: | ||
| - 6379:6379 | ||
| memcached: | ||
| image: memcached:1.6.9 | ||
| ports: | ||
|
|
@@ -22,19 +26,17 @@ jobs: | |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| ruby: ["3.4", "3.3", "3.2", "3.1"] | ||
| redis: ["5.x"] | ||
| ruby: ["3.4", "3.3", "3.2"] | ||
| rack: ["2.0", "3.0"] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we’re ensuring everything is tested against Rack 2 and 3. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what these versions are referring to but you should really be testing on 2.2.x and 3.2.x (and perhaps 3.1.x).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks heaps, changed this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the Gemfile we’re using |
||
| env: | ||
| RACK_VERSION: ${{ matrix.rack }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: ${{ matrix.ruby }} | ||
| bundler-cache: true | ||
| rubygems: latest # `gem update --system` is run to update to the latest compatible RubyGems version. | ||
| - name: Setup redis | ||
| uses: shogo82148/actions-setup-redis@v1 | ||
| with: | ||
| redis-version: ${{ matrix.redis }} | ||
| - name: Tests | ||
| run: bundle exec rspec | ||
| - name: Rubocop | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -329,7 +329,7 @@ def call(env) | |
| ) | ||
| end | ||
| elsif path == '/rack-mini-profiler/requests' | ||
| status, headers, body = [200, { 'Content-Type' => 'text/html' }, [blank_page_html.dup]] # important to dup here! | ||
| status, headers, body = [200, { Rack::CONTENT_TYPE => 'text/html' }, [blank_page_html.dup]] # important to dup here! | ||
| else | ||
| status, headers, body = @app.call(env) | ||
| end | ||
|
|
@@ -423,20 +423,20 @@ def action_parameters(env) | |
| def inject_profiler(env, status, headers, body) | ||
| # mini profiler is meddling with stuff, we can not cache cause we will get incorrect data | ||
| # Rack::ETag has already inserted some nonesense in the chain | ||
| content_type = headers['Content-Type'] | ||
| content_type = headers[Rack::CONTENT_TYPE] | ||
|
|
||
| if config.disable_caching | ||
| headers.delete('ETag') | ||
| headers.delete('Date') | ||
| headers.delete(Rack::ETAG) | ||
| headers.delete('date') || headers.delete('Date') | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There’s no |
||
| end | ||
|
|
||
| headers['X-MiniProfiler-Original-Cache-Control'] = headers['Cache-Control'] unless headers['Cache-Control'].nil? | ||
| headers['Cache-Control'] = "#{"no-store, " if config.disable_caching}must-revalidate, private, max-age=0" | ||
| headers['x-miniprofiler-original-cache-control'] = headers[Rack::CACHE_CONTROL] unless headers[Rack::CACHE_CONTROL].nil? | ||
| headers[Rack::CACHE_CONTROL] = "#{"no-store, " if config.disable_caching}must-revalidate, private, max-age=0" | ||
|
|
||
| # inject header | ||
| if headers.is_a? Hash | ||
| headers['X-MiniProfiler-Ids'] = ids_comma_separated(env) | ||
| headers['X-MiniProfiler-Flamegraph-Path'] = flamegraph_path(env) if current.page_struct[:has_flamegraph] | ||
| headers['x-miniprofiler-ids'] = ids_comma_separated(env) | ||
| headers['x-miniprofiler-flamegraph-path'] = flamegraph_path(env) if current.page_struct[:has_flamegraph] | ||
| end | ||
|
|
||
| if current.inject_js && content_type =~ /text\/html/ | ||
|
|
@@ -589,7 +589,7 @@ def analyze_memory | |
| end | ||
|
|
||
| def text_result(body, status: 200, headers: nil) | ||
| headers = (headers || {}).merge('Content-Type' => 'text/plain; charset=utf-8') | ||
| headers = (headers || {}).merge(Rack::CONTENT_TYPE => 'text/plain; charset=utf-8') | ||
| [status, headers, [body]] | ||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there was only one version of Redis tested, let’s use the official Redis image as a service.