• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 33611766024
97%

Build:
DEFAULT BRANCH: master
Ran 02 Sep 2026 09:00AM UTC
Jobs 32
Files 169
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Sep 2026 09:00AM UTC coverage: 96.938%. First build
33611766024

push

github

web-flow
Look content types up in a plain Hash instead of an indifferent one (#2883)

`PrecomputedContentTypes#content_type_for` answers what media type a format
maps to, and backed that with a `HashWithIndifferentAccess`:

    def content_type_for(format)
      content_types_indifferent_access[format]
    end

Every read therefore ran `convert_key` before the lookup, because the callers
disagree on spelling: the format negotiated from a path extension, a `?format=`
or an `Accept` header arrives as a String, while the API's declared format and
the value stashed in `api.format` are Symbols.

Both spellings can be present in the same Hash instead. It is built once per
middleware and never written again, so the conversion is work that only ever
had one answer.

    HWIA[:json]     42.3 ns  ->  Hash[:json]     25.5 ns   1.66x
    HWIA['json']    38.8 ns  ->  Hash['json']    33.7 ns   1.15x

`content_type_for` is called twice on a request — once to negotiate the format,
once to set the response content type — and three times when the path carries a
format extension. That is about 34 ns per request, roughly 0.6% of a minimal
one. End to end it sits below what the version_throughput harness can resolve,
so no end-to-end figure is claimed here. Allocation counts are unchanged:
`convert_key` used `Symbol#name`, which allocates nothing.

Keys arrive as Symbols — the `content_type` DSL calls `key.to_sym` and the
defaults are Symbols — but the key is also stored as it came, so a middleware
constructed directly with String keys still answers to either spelling, as the
indifferent hash did. Checked against `HashWithIndifferentAccess` over the
default content types plus unknown, nil and empty keys, and over a string-keyed
hash looked up both ways: same answer every time.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

1237 of 1332 branches covered (92.87%)

Branch coverage included in aggregate %.

6 of 6 new or added lines in 1 file covered. (100.0%)

3923 of 3991 relevant lines covered (98.3%)

27447.83 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/multi_json.gemfile - 33611766024.1 02 Sep 2026 09:00AM UTC 168
47.41
GitHub Action Run
2 run-4.0-gemfiles/rails_8_0.gemfile - 33611766024.2 02 Sep 2026 09:01AM UTC 169
95.7
GitHub Action Run
3 run-3.4-gemfiles/rails_8_1.gemfile - 33611766024.3 02 Sep 2026 09:01AM UTC 169
95.7
GitHub Action Run
4 run-3.4-Gemfile - 33611766024.4 02 Sep 2026 09:00AM UTC 168
95.69
GitHub Action Run
5 run-3.3-gemfiles/rails_7_2.gemfile - 33611766024.5 02 Sep 2026 09:00AM UTC 169
95.7
GitHub Action Run
6 run-3.4-gemfiles/rack_3_0.gemfile - 33611766024.6 02 Sep 2026 09:01AM UTC 168
95.69
GitHub Action Run
7 run-4.0-gemfiles/dry_validation.gemfile - 33611766024.7 02 Sep 2026 09:01AM UTC 168
57.83
GitHub Action Run
8 run-4.0-gemfiles/hashie.gemfile - 33611766024.8 02 Sep 2026 09:00AM UTC 168
61.8
GitHub Action Run
9 run-3.4-gemfiles/rails_7_2.gemfile - 33611766024.9 02 Sep 2026 09:01AM UTC 169
95.7
GitHub Action Run
10 run-3.3-gemfiles/rails_8_1.gemfile - 33611766024.10 02 Sep 2026 09:01AM UTC 169
95.7
GitHub Action Run
11 run-4.0-gemfiles/grape_entity.gemfile - 33611766024.11 02 Sep 2026 09:01AM UTC 168
50.33
GitHub Action Run
12 run-4.0-gemfiles/rack_2_2.gemfile - 33611766024.12 02 Sep 2026 09:00AM UTC 168
95.66
GitHub Action Run
13 run-4.0-gemfiles/rails_8_1.gemfile - 33611766024.13 02 Sep 2026 09:01AM UTC 169
95.7
GitHub Action Run
14 run-4.0-gemfiles/multi_json_1_20.gemfile - 33611766024.14 02 Sep 2026 09:00AM UTC 168
47.45
GitHub Action Run
15 run-3.3-gemfiles/rack_2_2.gemfile - 33611766024.15 02 Sep 2026 09:01AM UTC 168
95.65
GitHub Action Run
16 run-4.0-gemfiles/rack_3_0.gemfile - 33611766024.16 02 Sep 2026 09:00AM UTC 168
95.69
GitHub Action Run
17 run-4.0-gemfiles/rails_7_2.gemfile - 33611766024.17 02 Sep 2026 09:01AM UTC 169
95.7
GitHub Action Run
18 run-3.3-gemfiles/rack_3_2.gemfile - 33611766024.18 02 Sep 2026 09:00AM UTC 168
95.69
GitHub Action Run
19 run-4.0-gemfiles/grape_swagger.gemfile - 33611766024.19 02 Sep 2026 09:01AM UTC 168
55.22
GitHub Action Run
20 run-4.0-Gemfile - 33611766024.20 02 Sep 2026 09:01AM UTC 168
95.69
GitHub Action Run
21 run-3.4-gemfiles/rack_3_2.gemfile - 33611766024.21 02 Sep 2026 09:00AM UTC 168
95.69
GitHub Action Run
22 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33611766024.22 02 Sep 2026 09:01AM UTC 168
46.96
GitHub Action Run
23 run-3.3-Gemfile - 33611766024.23 02 Sep 2026 09:01AM UTC 168
95.69
GitHub Action Run
24 run-3.4-gemfiles/rails_8_0.gemfile - 33611766024.24 02 Sep 2026 09:00AM UTC 169
95.7
GitHub Action Run
25 run-4.0-gemfiles/multi_xml.gemfile - 33611766024.25 02 Sep 2026 09:00AM UTC 168
46.92
GitHub Action Run
26 run-3.3-gemfiles/rails_8_0.gemfile - 33611766024.26 02 Sep 2026 09:01AM UTC 169
95.7
GitHub Action Run
27 run-3.3-gemfiles/rack_3_0.gemfile - 33611766024.27 02 Sep 2026 09:01AM UTC 168
95.69
GitHub Action Run
28 run-4.0-gemfiles/rack_3_1.gemfile - 33611766024.28 02 Sep 2026 09:00AM UTC 168
95.69
GitHub Action Run
29 run-4.0-gemfiles/rack_3_2.gemfile - 33611766024.29 02 Sep 2026 09:01AM UTC 168
95.69
GitHub Action Run
30 run-3.3-gemfiles/rack_3_1.gemfile - 33611766024.30 02 Sep 2026 09:00AM UTC 168
95.69
GitHub Action Run
31 run-3.4-gemfiles/rack_3_1.gemfile - 33611766024.31 02 Sep 2026 09:01AM UTC 168
95.69
GitHub Action Run
32 run-3.4-gemfiles/rack_2_2.gemfile - 33611766024.32 02 Sep 2026 09:01AM UTC 168
95.66
GitHub Action Run
Source Files on build 33611766024
  • Tree
  • List 169
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33611766024
  • b404ba96 on github
  • Prev Build on master (#33611610005)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc