Forward & Reverse Geocoding

FREEMIUM
Verified
Por Geocoding | Atualizado 21日前 | Mapping
Popularidade

9.9 / 10

Latência

92ms

Nível de serviço

100%

Health Check

100%

Voltar para todas as discussões

Bug: Request with empty query parameter

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 1年前

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 1年前

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 1年前

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.

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários