2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/spec/lib/middleware
David Taylor 2d615863d2
DEV: Fix AnonymousCache for pitchfork in dev/test modes (#37852)
In development mode, AnonymousCache is disabled by default, so we hadn't
noticed this. And we haven't started using pitchfork in test mode yet.

Pitchfork adds the `Rack::Lint` middleware to the top of the stack in
non-production environments:
c95f7a6e/lib/pitchfork.rb (L100).
This causes a failure on our non-rack-spec-compliant call to
`env[Rack::RACK_INPUT].size`.

Pitchfork implements the `#size` method, but marks it as for
backward-compatibility for Rack < 1.2:
c95f7a6e/lib/pitchfork/tee_input.rb (L60-L71).
The implementation reads the entire string from the stream and checks
the length. In our case, we can just try reading one byte to determine
whether any body has been received. This is compliant with the modern
Rack spec, and will pass the `Rack::Lint` middleware checks.
2026-02-17 09:12:02 +00:00
..
anonymous_cache_spec.rb DEV: Fix AnonymousCache for pitchfork in dev/test modes (#37852) 2026-02-17 09:12:02 +00:00
crawler_hooks_spec.rb DEV: Check for setting prior to applying transformation on crawler view (#34478) 2025-08-22 14:17:45 +08:00
discourse_public_exceptions_spec.rb
enforce_hostname_spec.rb
overload_protections_spec.rb PERF: Reject anonymous requests with 503 upon aggressive queuing (#36519) 2025-12-18 10:23:42 +08:00
processing_request_spec.rb PERF: Reject anonymous requests with 503 upon aggressive queuing (#36519) 2025-12-18 10:23:42 +08:00
request_tracker_spec.rb DEV: Add feature flag for browser pageview events (#36986) 2026-01-07 15:16:18 +08:00