I have a simple POST request, which is working as expected on all platforms except HTML5.
In HTML5, my game sends GET request somehow, any idea why could it happen?
package;
import openfl.display.Sprite;
import openfl.net.*;
class Main extends Sprite {
public function new () {
super ();
var vars = new URLVariables ();
vars.hello = 100;
var _req = new URLRequest("./assets/foo");
_req.data = vars;
_req.method = URLRequestMethod.POST;
//_onReq = onReq;
var _loader = new URLLoader ();
_loader.dataFormat = URLLoaderDataFormat.TEXT;
_loader.load(_req);
}
}
Opening the HTTP debugger, and checking the Network tab (after a refresh), showed the following:
Request URL:http://127.0.0.1:3000/assets/foo
Request Method:POST
Status Code:405 Method Not Allowed
Remote Address:127.0.0.1:3000
Referrer Policy:no-referrer-when-downgrade
So the address I requested was bad, but looks like it is sending the request as POST properly
Ok, I’ve checked in browser’s dev tools and I get a different results.
Here is request from Flash version:
And here is HTML5:
UPDATE: Problem occurs when you send request to actual url.
In your example, “./assets/foo” works fine for me too, I see POST request, but changing it to real url makes it OPTIONS.