Closed wqjGitHub closed 7 years ago
stream.fetch({ method: 'POST', url: POST_URL, type:'json', body: JSON.stringify({ data: bodyString }) }, function(ret) { console.info("post", ret); if(!ret.ok){ me.postResult = "request failed"; }else{ console.log('get:'+JSON.stringify(ret)); me.postResult = JSON.stringify(ret.data); } },function(response){ console.log('get in progress:'+response.length); me.postResult = "bytes received:"+response.length; });
服务器响应:{"status":200,"ok":true,"statusText":"OK","data":null,"headers":{"Content-Type":"application/json;charset=GBK"}}
其中data为null,服务器无法取到body内容,如果用get方式正常。 而jquery: $.ajax({ url : app.config.remote_addr, timeout : app.config.debug ? 40000 : 20000, dataType : 'json', data : { 'data' : JSON.stringify(json) }, type : 'POST', )};完全正常。
服务器响应:{"status":200,"ok":true,"statusText":"OK","data":null,"headers":{"Content-Type":"application/json;charset=GBK"}}
其中data为null,服务器无法取到body内容,如果用get方式正常。 而jquery: $.ajax({ url : app.config.remote_addr, timeout : app.config.debug ? 40000 : 20000, dataType : 'json', data : { 'data' : JSON.stringify(json) }, type : 'POST', )};完全正常。