Skip to content
Snippets Groups Projects
Commit 2edfdab6 authored by Yamagishi Kazutoshi's avatar Yamagishi Kazutoshi Committed by Eugen Rochko
Browse files

Don't send Link header when don't know prev and next links (#4633)

parent 4edf9d84
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ class Api::BaseController < ApplicationController
links = []
links << [next_path, [%w(rel next)]] if next_path
links << [prev_path, [%w(rel prev)]] if prev_path
response.headers['Link'] = LinkHeader.new(links)
response.headers['Link'] = LinkHeader.new(links) unless links.empty?
end
def limit_param(default_limit)
......
......@@ -70,8 +70,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
it 'does not add pagination headers if not necessary' do
get :index
expect(response.headers['Link'].find_link(['rel', 'next'])).to eq nil
expect(response.headers['Link'].find_link(['rel', 'prev'])).to eq nil
expect(response.headers['Link']).to eq nil
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment