Trying to use URLVariables

I’m trying to port this class from AS3 to Haxe + OpenFL. Most of it is working well with essentially the same code, just with Haxe syntax and openfl imports. I’ve only made 2 significant changes.

The first is that I don’t have the lines setting req.cacheResponse and req.useCache since those don’t seem to be included in OpenFL’s URLRequest class.
The second is that I’ve replaced these lines:

for (var p:String in params) {
vars[p] = params[p];
}

with these:

for (i in Reflect.fields(params)){
vars[i] = params[i];
}

So that it can iterate properly. However, I get these errors for the line that sets vars[i]:

String should be Int
Array access is not allowed on openfl.net.URLVariables

If URLVariables doesn’t allow array access then how do I port that code? Or is there a better way to do this without OpenFL (i.e. pure Haxe or some other library)? I want to do this for the Flash target.

for (i in Reflect.fields(params)){
    Reflect.setField(vars, i, Reflect.field(params, i));
}