Skip to content

Commit

Permalink
Merge pull request #98 from OpenGeoMetadata/97-json-format
Browse files Browse the repository at this point in the history
Ensure that the format param is always appended to paged catalog urls
  • Loading branch information
Jessie Keck committed Sep 18, 2020
2 parents 3578842 + a58ee6c commit 5d766aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/geo_combine/geo_blacklight_harvester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def documents

url = response.dig('links', 'next')
break unless url
url = "#{url}&format=json"
self.page += 1
puts "Fetching page #{page} @ #{url}" if GeoCombine::GeoBlacklightHarvester.config[:debug]
begin
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/geo_combine/geo_blacklight_harvester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
before do
allow(RSolr).to receive(:connect).and_return(stub_solr_connection)
expect(Net::HTTP).to receive(:get).with(
URI('https://example.com?f%5Bdct_provenance_s%5D%5B%5D=INSTITUTION&format=json&per_page=100&page=2')
URI('https://example.com/catalog.json?f%5Bdct_provenance_s%5D%5B%5D=INSTITUTION&per_page=100&page=2&format=json')
).and_return(second_results_response.to_json)
end

Expand All @@ -157,7 +157,7 @@
{ 'links' => { 'self' => 'https://example.com/catalog/abc-123' } },
{ 'links' => { 'self' => 'https://example.com/catalog/abc-321' } }
],
'links' => { 'next' => 'https://example.com?f%5Bdct_provenance_s%5D%5B%5D=INSTITUTION&format=json&per_page=100&page=2' }
'links' => { 'next' => 'https://example.com/catalog.json?f%5Bdct_provenance_s%5D%5B%5D=INSTITUTION&per_page=100&page=2' }
}
end

Expand Down

0 comments on commit 5d766aa

Please sign in to comment.