request header 設置
var loader: egret.URLLoader = new egret.URLLoader();
loader.dataFormat = egret.URLLoaderDataFormat.TEXT;
loader.addEventListener(egret.Event.COMPLETE, (e: egret.Event) => {
console.log(e.target.data);
}, this);
let request = new egret.URLRequest("http://httpbin.org/get");
request.method = egret.URLRequestMethod.GET;
let headers: egret.URLRequestHeader[] = request.requestHeaders;
headers.push(new egret.URLRequestHeader('Accept', 'text/json')); // 告知(服務器)客户端可以處裡的内容類型
loader.load(request);
沒有留言:
張貼留言