Skip to content

Commit 48e2912

Browse files
committed
Set Vary header to X-Inertia
1 parent 74fab7c commit 48e2912

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/inertia_rails/renderer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def initialize(component, controller, request, response, render_method, props: n
1919

2020
def render
2121
if @request.headers['X-Inertia']
22-
@response.set_header('Vary', 'Accept')
22+
@response.set_header('Vary', 'X-Inertia')
2323
@response.set_header('X-Inertia', 'true')
2424
@render_method.call json: page, status: @response.status, content_type: Mime[:json]
2525
else

spec/inertia/rendering_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
it 'has the proper headers' do
5151
expect(response.headers['X-Inertia']).to eq 'true'
52-
expect(response.headers['Vary']).to eq 'Accept'
52+
expect(response.headers['Vary']).to eq 'X-Inertia'
5353
expect(response.headers['Content-Type']).to eq 'application/json; charset=utf-8'
5454
end
5555

spec/inertia/ssr_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
it 'allows inertia to take over when inertia headers are passed' do
4242
get props_path, headers: {'X-Inertia' => true, 'X-Inertia-Version' => '1.0'}
4343

44-
expect(response.headers['Vary']).to eq 'Accept'
44+
expect(response.headers['Vary']).to eq 'X-Inertia'
4545
expect(response.headers['Content-Type']).to eq 'application/json; charset=utf-8'
4646
end
4747
end

0 commit comments

Comments
 (0)