Module | Turbolinks::Assertions |
In: |
lib/turbolinks/assertions.rb
|
TURBOLINKS_VISIT | = | /Turbolinks\.visit\("([^"]+)", {"action":"([^"]+)"}\)/ |
Rough heuristic to detect whether this was a Turbolinks request: non-GET request with a text/javascript response.
Technically we‘d check that Turbolinks-Referrer request header is also set, but that‘d require us to pass the header from post/patch/etc test methods by overriding them to provide a `turbolinks:` option.
We can‘t check `request.xhr?` here, either, since the X-Requested-With header is cleared after controller action processing to prevent it from leaking into subsequent requests.