js/jsfun/fnRequest.js HTTP请求操作
//请求地址:
console.log("取得请求地址信息:", fnRequest_url())
console.log("取得请求完整地址信息:", fnRequest_urlFull())
//Nginx配置HTTPS站点时,需要增加设置头部信息:proxy_set_header Jssaas-Scheme $scheme; #将请求协议http、https信息放入头部传递给jsaaas
console.log("取得请求完整地址信息(http):", fnRequest_urlFull(true))
//头部信息
console.log("取得头部信息:", fnRequest_headerGet("User-Agent"))
console.log("取得头部信息:", fnRequest_headerAll())
// 请求参数数据:
//get
console.log("取得GET请求参数:", fnRequest_get())
console.log("取得GET请求数组参数:", fnRequest_getArray())
console.log("取得GET请求正则地址参数数组:", fnRequest_urlRegParams())
//post
console.log("取得请求Post Form信息:", fnRequest_post())
console.log("取得请求Post Form数组信息:", fnRequest_postArray())
console.log("取得请求JSON(post payload请求)信息:", fnRequest_json())
//file
console.log("取得请求文件信息:", fnRequest_file())
console.log("取得请求文件信息(包含文件内容):", fnRequest_file(true))
console.log("取得请求文件保存:", fnRequest_fileSave(fnJsa_jsCodePath()+"/aa.xlsx"))
//body
console.log("取得请求BODY信息:", fnRequest_body())
//IP:
console.log("取得客户端IP信息:", fnRequest_clientIP())
//连接ID
console.log("取得请求连接ID:", fnRequest_id())
/**
* 动态地址
* @param params
* @jssaas url /funRequest-(.*)-(.?)(.+)(.?)\.html
* @jssaas urlisreg true
* @jssaas urlregindex 5
* @jssaas method get,post,get,put,delete
* @jssaas timeout 10000
*/
function main_fun_request2(params) {
let t1 = fnTime_timestampMilli();
// 请求参数数据:
//get
console.log("取得GET请求参数:", fnRequest_get())
console.log("取得GET请求数组参数:", fnRequest_getArray())
console.log("取得GET请求正则地址参数数组:", fnRequest_urlParams())
let t2 = fnTime_timestampMilli();
return fnRender_template("/html/index.html", {"t": t2 - t1})
}