add gzip test

This commit is contained in:
jianglong0156 2015-06-05 11:40:29 +08:00
parent 97d0265e32
commit 33beab2d81
1 changed files with 7 additions and 4 deletions

View File

@ -103,9 +103,12 @@ var XHRTestLayer = cc.Layer.extend({
streamXHREventsToLabel(xhr, statusGetLabel, responseLabel, "GET");
// 5 seconds for timeout
xhr.timeout = 5000;
xhr.setRequestHeader("Accept-Encoding","gzip,deflate");
//set arguments with <URL>?xxx=xxx&yyy=yyy
xhr.open("GET", "http://httpbin.org/get?show_env=1", true);
xhr.open("GET", "http://geek.csdn.net/news/detail/33683", true);
xhr.send();
},
@ -127,8 +130,8 @@ var XHRTestLayer = cc.Layer.extend({
var xhr = cc.loader.getXMLHttpRequest();
streamXHREventsToLabel(xhr, statusPostLabel, responseLabel, "POST");
xhr.setRequestHeader("Accept-Encoding","gzip,deflate");
xhr.open("POST", "http://httpbin.org/post", true);
xhr.open("POST", "http://httpbin.org/post");
//set Content-type "text/plain;charset=UTF-8" to post plain text
xhr.setRequestHeader("Content-Type","text/plain;charset=UTF-8");