aardio 文档
aardio 范例: 分步请求
//分步请求
import console;
import inet.http;
//首先创建 HTTP 客户端对象
var http = inet.http();
//创建 HTTP 请求,参数 @2指定请求方法,更多参数请查看函数说明
http.beginRequest("http://localhost:8082/test.txt","OPTIONS");
//发送请求
http.send();
//读取 HTTP 响应头(要在发送请求头后才能读取 )。
var headers = http.readHeader();
console.log(headers);
//读取数据
//var data = http.readAll();
//创建 HTTP 请求,参数 @2指定请求方法,更多参数请查看函数说明
http.beginRequest("http://localhost:8082/test.txt","OPTIONS");
//发送请求
http.send();
//读取 HTTP 响应头(要在发送请求头后才能读取 )。
var headers = http.readHeader();
console.log(headers);
//读取数据
var data = http.readAll();
console.log(data);
//结束请求
http.endRequest();
/*
注意以上分步请求的方式不会自动设置认证信息以自动登录。
如果需要登录可事先调用 get 或 head 等请求登录。
*/
console.pause()
Markdown 格式