Skip to content

Commit

Permalink
Merge pull request sozialhelden#673 from sozialhelden/fix-use-https-f…
Browse files Browse the repository at this point in the history
…or-nominatim

search fix: use https for nominatim
  • Loading branch information
Thuy Le authored May 15, 2018
2 parents bcd0cc9 + 03da31f commit 2c7c127
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SearchController < ApplicationController
URL = 'http://nominatim.openstreetmap.org/search'.freeze
URL = 'https://nominatim.openstreetmap.org/search'.freeze
# URL = "http://open.mapquestapi.com/nominatim/v1/search"
DEFAULT_PARAMS = { limit: 10, email: '[email protected]', dedupe: '1' }.freeze
USERAGENT = 'Wheelmap v1.0, (http://wheelmap.org)'.freeze
Expand All @@ -15,6 +15,8 @@ class SearchController < ApplicationController
def index
@search_url = URI.parse(URL)
@http = Net::HTTP.new(@search_url.host, @search_url.port)
@http.use_ssl = true
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
@http.read_timeout = 2
@http.open_timeout = 2
@query = DEFAULT_PARAMS.reverse_merge('accept-language': I18n.locale, q: params[:q])
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/search_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

describe SearchController do
before :each do
@search_api_url = 'http://nominatim.openstreetmap.org/search?q=Leipziger+Strasse%2C+Berlin&format=xml&limit=10&accept-language=de&dedupe=1&email=info%40wheelmap.org'
@search_api_url = 'https://nominatim.openstreetmap.org/search?q=Leipziger+Strasse%2C+Berlin&format=xml&limit=10&accept-language=de&dedupe=1&email=info%40wheelmap.org'

stub_request(:get, @search_api_url)
.to_return(status: 200, body: File.read("#{Rails.root}/spec/fixtures/search.xml"))
Expand Down

0 comments on commit 2c7c127

Please sign in to comment.