prometheus / client_ruby

Prometheus instrumentation library for Ruby applications
Apache License 2.0
513 stars 149 forks source link

Fix `Rack` deprecation warning #278

Closed Sinjo closed 1 year ago

Sinjo commented 1 year ago

Right now, our tests are spamming this:

./home/circleci/project/spec/prometheus/middleware/exporter_spec.rb:38: warning: Rack::Response#header is deprecated and will be removed in Rack 3.1

We should switch to using whatever the replacement is. From a quick grep, it looks like we only call that method in tests, so we shouldn't have to worry about maintaining compatibility with multiple versions in the library code.

$ git grep -n '\.header'
spec/prometheus/middleware/exporter_spec.rb:38:        expect(last_response.header['content-type']).to eql(fmt::CONTENT_TYPE)
spec/prometheus/middleware/exporter_spec.rb:50:        expect(last_response.header['content-type']).to eql('text/plain')
spec/prometheus/middleware/exporter_spec.rb:111:          expect(last_response.header['content-type']).to eql(text::CONTENT_TYPE)