URLLoader POST html5 variables

I don’t see the option to send urlvariables with POST when targeting html5, if I use URLVariables they seem to be ignored, when using GET everything seems to work fine. Am I using this the wrong way? It works fine when I’m compiling to neko.

var request = new URLRequest(url);
var requestVars = new URLVariables();
requestVars.data = 'test';
request.method = 'POST';
request.data = requestVars;
var urlLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

I’ve added

 var headers:Array<URLRequestHeader> = [];
headers.push(new URLRequestHeader("Content-type", "application/x-www-form-urlencoded"));
request.requestHeaders = headers;

to my code and now it works fine :slight_smile:

Nice, do you think we need this by default whenever using POST? Or is there times someone would not want this?

As far as I know some people might want to use “multipart/form-data” header instead of “application/x-www-form-urlencoded”. multipart/form-data allows submiting binary data.