Skip to content

Commit 2884752

Browse files
author
Moncef Belyamani
committed
Don't return Link header if it's blank
1 parent bb04ad6 commit 2884752

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/api-pagination.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def paginate(scope)
2222
%(<#{url}?#{new_params.to_param}>; rel="#{k}")
2323
end
2424

25-
headers['Link'] = links.join(', ')
25+
headers['Link'] = links.join(', ') unless links.empty?
2626
end
2727
end
2828

spec/controllers/numbers_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def index
3434
context 'without enough items to give more than one page' do
3535
it 'should not paginate' do
3636
get :index, count: 20
37-
response.headers['Link'].should be_blank
37+
response.headers.keys.should_not include("Link")
3838
end
3939
end
4040

0 commit comments

Comments
 (0)