Reputation: 3299
Given the following simple code
Uri url = new Uri.http("localhost:8090", "/browseDirectories",{"path":"\log\fastdmo.localhost.log"});
http.get( url).then( (response) {
print( response.body);
});
I find that the http.get() method does not make the correct call on the web server As far as I can see the url becomes
http://localhost:8090/browseDirectories?path=log%0Castdmo.localhost.log
I know this is because the leading \ of the path parameter gets dropped, but how do I prevent that from happening?
Upvotes: 0
Views: 68
Reputation: 21383
You can use a raw string by prefixing the string with r:
Uri url = new Uri.http("localhost:8090", "/browseDirectories",{"path":r"\log\fastdmo.localhost.log"});
which will result in the following URL:
http://localhost:8090/browseDirectories?path=%5Clog%5Cfastdmo.localhost.log
Alternatively, you can use a second backslash to escape the backslash:
Uri url = new Uri.http("localhost:8090", "/browseDirectories",{"path":"\\log\\fastdmo.localhost.log"});
Upvotes: 2