diff --git a/app/controllers/collection_controller.rb b/app/controllers/collection_controller.rb index ca8492861..1608285c0 100644 --- a/app/controllers/collection_controller.rb +++ b/app/controllers/collection_controller.rb @@ -61,7 +61,9 @@ def local_id_search @results = find_by_localid(collection_ark, params[:terms]) return render_object_info(@results[0].ark) if @results.length == 1 end - render status: 204, json: {}.to_json + # Not sure why 201, this probably should have returned a 204 (Empty Result). + # The Api has been returning the 201 (Accepted) for some time, so this will remain unchanged. + render status: 201, json: {}.to_json end private diff --git a/app/controllers/owner_controller.rb b/app/controllers/owner_controller.rb index 45236a533..f8797f365 100644 --- a/app/controllers/owner_controller.rb +++ b/app/controllers/owner_controller.rb @@ -41,7 +41,9 @@ def search_results @results = find_by_file_name(@request_owner, term) if @results.empty? @results = find_by_full_text(@request_owner, terms) if @results.empty? end - render status: @results.empty? ? 204 : 200 + # The 201 (Accepted) being returned should have probably been a 204 (Empty Result). + # The collection search API has been returning 201 for some time, so this will be unchanged. + render status: @results.empty? ? 201 : 200 end private diff --git a/spec/controllers/collection_controller_spec.rb b/spec/controllers/collection_controller_spec.rb index 74049e6cd..1aef1e3b2 100644 --- a/spec/controllers/collection_controller_spec.rb +++ b/spec/controllers/collection_controller_spec.rb @@ -68,7 +68,7 @@ mock_permissions_all(user_id, collection_id) request.session.merge!({ uid: user_id }) get(:local_id_search, params: { group: @collection.group, terms: 'my-local-id-not-found' }) - expect(response.status).to eq(204) + expect(response.status).to eq(201) end it 'localid search - result found' do diff --git a/spec/controllers/owner_controller_spec.rb b/spec/controllers/owner_controller_spec.rb index d64330944..73fac9ee4 100644 --- a/spec/controllers/owner_controller_spec.rb +++ b/spec/controllers/owner_controller_spec.rb @@ -63,7 +63,7 @@ def mock_owner_name(name) mock_owner_name(@owner.name) request.session.merge!({ uid: user_id }) get(:search_results, params: { terms: 'my-local-id-not-found', owner: @owner.name }) - expect(response.status).to eq(204) + expect(response.status).to eq(201) end it 'empty terms search no results' do @@ -71,7 +71,7 @@ def mock_owner_name(name) mock_owner_name(@owner.name) request.session.merge!({ uid: user_id }) get(:search_results, params: { terms: '', owner: @owner.name }) - expect(response.status).to eq(204) + expect(response.status).to eq(201) end it 'localid search - result found' do diff --git a/spec/features/owner_spec.rb b/spec/features/owner_spec.rb index 97a37ace4..cbb21e6e3 100644 --- a/spec/features/owner_spec.rb +++ b/spec/features/owner_spec.rb @@ -78,7 +78,7 @@ def mock_owner_name(_user, name) it 'finds by substring, no objects found' do fill_in('terms', with: 'Jan') click_button 'Go' - expect(page).to have_content('here were no items that had the text matching') + expect(page).to have_content('There were no items that had the text matching') end it 'finds by ark' do