天软金融分析.NET函数大全 > TSL函数 > 资源访问函数 > 网络访问以及相关函数

ClearHttpHeader    

简述
清除会话中的请求头信息
定义
ClearHttpHeader([Session:Integer]);
参数
名称类型说明
Sessioninteger可选参数,整数类型,session ID,缺省时指当前会话。
  • 范例

    skey := "{36F4-XXXX-4520}"; //租户Session Key,用户需替换成自己的Session Key
    url := "https://opi.tinysoft.com.cn/Service/Session/Call/";
    sid := CreateHttpSession(); //创建会话
    header := "TS-CALL-NAME: NoName10\r\nAuthorization: Bearer "+skey; //调用函数名以及认证信息
    AppendHttpHeader(sid,header); //向会话中添加请求头信息
    r := PostHttp(sid,url,"{}",30000,res,resp);
    echo "->r:",r,"->resp:",resp,"->res:",res,"\r\n";
    ClearHttpHeader(sid); //清除会话中请求头信息
    header := "TS-CALL-NAME: NoName11\r\nAuthorization: Bearer "+skey; //调用函数名以及认证信息
    AppendHttpHeader(sid,header); //向会话中添加请求头信息
    r := PostHttp(sid,url,"{}",30000,res,resp);
    echo "->r:",r,"->resp:",resp,"->res:",res,"\r\n";
    DestroyHttpSession(sid); //销毁会话
    return ;

    结果:
相关