Module: Inertia::RSpec::RequestHelpers
- Defined in:
- lib/inertia/rspec.rb
Instance Method Summary collapse
-
#get(inertia: {}, headers: {}) ⇒ Object
Performs a GET request with optional Inertia partial reload headers.
Instance Method Details
#get(inertia: {}, headers: {}) ⇒ Object
Performs a GET request with optional Inertia partial reload headers.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/inertia/rspec.rb', line 88 def get(*, inertia: {}, headers: {}, **) if inertia.except(:only, :except).any? raise ArgumentError, "Unknown :inertia option. Supported values are :only and :except" end if inertia.any? headers = headers.merge({ "X-Inertia" => "true", "X-Inertia-Partial-Component" => self.inertia&.component || double(:== => true) }) if only = inertia[:only] headers["X-Inertia-Partial-Data"] = Array(only).join(",") elsif except = inertia[:except] headers["X-Inertia-Partial-Except"] = Array(except).join(",") end end super(*, headers:, **) end |