Skip to content
Snippets Groups Projects
Commit 4af45d7a authored by Alex Reisner's avatar Alex Reisner
Browse files

Add trailing slash to avoid redirect.

parent 396e78ac
No related branches found
No related tags found
No related merge requests found
......@@ -23,17 +23,17 @@ module Geocoder::Lookup
private # ---------------------------------------------------------------
def base_url(query)
url = "#{protocol}://dev.virtualearth.net/REST/v1/Locations"
url = "#{protocol}://dev.virtualearth.net/REST/v1/Locations/"
if !query.reverse_geocode?
if r = query.options[:region]
url << "/#{r}"
url << "#{r}/"
end
# use the more forgiving 'unstructured' query format to allow special
# chars, newlines, brackets, typos.
url + "?q=" + URI.escape(query.sanitized_text.strip) + "&"
else
url + "/#{URI.escape(query.sanitized_text.strip)}?"
url + "#{URI.escape(query.sanitized_text.strip)}?"
end
end
......
......@@ -42,7 +42,7 @@ class BingTest < GeocoderTestCase
"manchester",
:region => "uk"
))
assert_match(/Locations\/uk\?q=manchester/, url)
assert_match(%r!Locations/uk/\?q=manchester!, url)
assert_no_match(/query/, url)
end
......@@ -51,7 +51,7 @@ class BingTest < GeocoderTestCase
url = lookup.query_url(Geocoder::Query.new(
"manchester"
))
assert_match(/Locations\?q=manchester/, url)
assert_match(%r!Locations/\?q=manchester!, url)
assert_no_match(/query/, url)
end
......@@ -61,7 +61,7 @@ class BingTest < GeocoderTestCase
"manchester, lancashire",
:region => "uk"
))
assert_match(/Locations\/uk\?q=manchester,%20lancashire/, url)
assert_match(%r!Locations/uk/\?q=manchester,%20lancashire!, url)
assert_no_match(/query/, url)
end
......@@ -71,7 +71,7 @@ class BingTest < GeocoderTestCase
" manchester, lancashire ",
:region => "uk"
))
assert_match(/Locations\/uk\?q=manchester,%20lancashire/, url)
assert_match(%r!Locations/uk/\?q=manchester,%20lancashire!, url)
assert_no_match(/query/, url)
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