Forward & Reverse Geocoding

FREEMIUM
Verified
Door Geocoding | Bijgewerkt il y a un mois | Mapping
Populariteit

9.9 / 10

Latency

93ms

Serviceniveau

100%

Health Check

100%

Terug naar alle discussies

Bug: Request with empty query parameter

Rapid account: Andreas Pradel Caruso
AndreasPradelCaruso
il y a un an

When using geocoding search I am able to send empty string for the parameter ‘q’ even though it’s required.
The URL used is: https://forward-reverse-geocoding.p.rapidapi.com/v1/search?q=&addressdetails=1&limit=1
As a result I get this Object:
{
“lat”: “52.720615499999994”,
“lon”: “58.66574618108943”,
“displayName”: “Sibay, городской округ Сибай, Baschkortostan, Föderationskreis Wolga, UNDEFINED, Russland”
}
(It’s in German, but yeah, it’s somewhere in Russia)

Rapid account: Geocode Support
GeocodeSupport Commented il y a un an

Yes, so it’s best to first check if your variable for q (or any other field in the query) is not empty|undefined|null|none etc. (depending on the language used).

Rapid account: Andreas Pradel Caruso
AndreasPradelCaruso Commented il y a un an

Ah, then it looks like the Angular HTTP Client automatically adds “undefined” to URLs when it detects an empty parameter. Good to know!
Also thanks for pointing it out, I printed the URL into my console before I gave it to the HTTP Client and there it didn’t contain “undefined”.

Rapid account: Geocode Support
GeocodeSupport Commented il y a un an

Hi Andreas, this did not happen with an empty string for q, but with a string of “undefined” (which is not undefined but just a string with the value “undefined”).

So you searched for https://forward-reverse-geocoding.p.rapidapi.com/v1/search?q=undefined&addressdetails=1&limit=1

Now “undefined” should be a stop word but currently is not (these are always hard edge cases, e.g. how would you treat a store that is called “Undefined”? We do have the same edge case with “null”).

If you do send an empty string for q at the search endpoint, you won’t get a result.

Doe mee aan de discussie - voeg hieronder een opmerking toe

Log in / Schrij u in om nieuwe opmerkingen te plaatsen