COMMUNITY

Http request with url fails

I have a problem with the url: https://overpass-api.de/api/interpreter?data=[out:json];(node[name](57.697255528906794,11.901648888613714,57.709701878362885,11.918365178920073);<;);out meta;
It works in the browser, but when I:

Http.requestUrl("https://overpass-api.de/api/interpreter?data=[out:json];(node[name](57.697255528906794,11.901648888613714,57.709701878362885,11.918365178920073);<;);out meta;");

… I get the following log:

/usr/local/lib/haxe/std/sys/Http.hx:495: characters 4-9 : Uncaught exception Http Error #400
/usr/local/lib/haxe/std/sys/Http.hx:65: characters 4-14 : Called from here
/usr/local/lib/haxe/std/sys/Http.hx:251: characters 12-25 : Called from here
/usr/local/lib/haxe/std/sys/Http.hx:68: characters 3-30 : Called from here
/usr/local/lib/haxe/std/sys/Http.hx:497: characters 3-19 : Called from here
src/Service.hx:37: characters 12-179 : Called from here
src/Main.hx:7: characters 17-38 : Called from here

What is the problem, has it anything to do with the semicolons?

It seems some unsafe url chars need to be escaped, this works for me in both curl and Haxe : https://overpass-api.de/api/interpreter?data=%5Bout%3Ajson%5D;(node%5Bname%5D(57.697255528906794,11.901648888613714,57.709701878362885,11.918365178920073);%3C;);out%20meta;

Thanks that worked.
I found a table that helped me see the changes: URL Escape Codes

Nice ! StringTools.urlEncode() can escape these characters, but passing the full url through it mangles it too much, and overpass seems a bit sensitive too so it is was trial and error.