discourse/spec
David Taylor 1db3a578e4
PERF: Improve Accept header handling for stylesheets and theme-js (#19357)
The default behavior for Rails is to vary the response of an endpoint based on the `Accept:` header, and therefore it returns a `Vary:` header on responses. This instructs browsers and intermediate proxies to key their caches based on the value of the request's `Accept` header. In some cases (e.g. Akamai), the presence of a `Vary` header is enough to prevent caching entirely.

This commit restructures the Rails route definitions so that:
1. The "format" segment of the route is 'required'
2. The "format" segment of the route is constrained to a single value (e.g. `js` or `css`)

Now that the routes are guaranteed to have a `:format` segment, Rails will always prioritize that over the `Accept` header, and will therefore omit the `Vary` header.

Request specs are also added to test this behaviour for both stylesheets and theme-javascripts.
2022-12-07 15:46:35 +00:00
..
fabricators PERF: stop downloading images from post processor and lean on uploads 2022-11-25 12:40:31 +11:00
fixtures FEATURE: Youtube Short onebox support (#19335) 2022-12-06 11:56:48 -03:00
helpers Meta topic: https://meta.discourse.org/t/meta-theme-color-is-not-respecting-current-color-scheme/239815 (#18832) 2022-11-07 10:06:26 +03:00
import_export DEV: Add a rake task to export/import translation overrides (#18487) 2022-10-05 15:22:16 -04:00
initializers Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
integration FEATURE: Track API and user API requests (#19186) 2022-11-29 13:07:42 +02:00
integrity DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
jobs FIX: Exclude claimed reviewables from user menu (#19179) 2022-12-01 07:09:57 +08:00
lib DEV: Support colocation under /admin namespace in themes/plugins (#19353) 2022-12-07 14:24:03 +00:00
mailers SECURITY: Filter tags in user notifications for visibility (#19239) 2022-11-29 10:35:41 -06:00
models UX: Exclude search ignored and user muted categories in similarity search (#19349) 2022-12-07 11:33:01 +08:00
multisite DEV: Fix mocha deprecations (#18828) 2022-11-02 10:47:59 +01:00
requests PERF: Improve Accept header handling for stylesheets and theme-js (#19357) 2022-12-07 15:46:35 +00:00
script/import_scripts DEV: Remove remaining hardcoded ids (#18735) 2022-10-25 15:29:09 +08:00
serializers DEV: Remove user options from current user serializer (#19089) 2022-12-05 18:25:30 +02:00
services FIX: Push category hashtag slug match to top (#19174) 2022-11-25 15:28:49 +10:00
support FIX: horizontal scrolling was not working correctly (#19236) 2022-12-01 05:27:53 +08:00
system FIX: horizontal scrolling was not working correctly (#19236) 2022-12-01 05:27:53 +08:00
tasks FIX: Allow attr updates of over-size-limit uploads (#18986) 2022-11-11 17:56:11 +01:00
views DEV: use structured data in topic-list for referencing only (#16235) 2022-12-05 18:00:32 +02:00
rails_helper.rb FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937) 2022-11-21 08:37:06 +10:00
regenerate_swagger_docs DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
swagger_helper.rb DEV: Update rubocop (#18754) 2022-10-26 09:05:15 +08:00