How to add/overwrite a HTTP header using THTTPReqResp?

前端 未结 1 1623
春和景丽
春和景丽 2021-01-14 05:57

I want to approach the Exchange EWS webservice and handle XML SOAP composition (request) and parsing (response) myself. Therefore, THTPPRIO seems a bit overkill.

I\'

相关标签:
1条回答
  • 2021-01-14 06:28

    I found it:

    procedure TForm1.BeforeRRPost(const HTTPReqResp: THTTPReqResp; Data: Pointer);
    const
       cContentHeader = 'Content-Type: text/xml; charset=utf-8';
    begin
       HttpAddRequestHeaders(Data, PChar(cContentHeader), Length(cContentHeader), HTTP_ADDREQ_FLAG_REPLACE);
    // Or  HttpAddRequestHeaders(Data, PChar(cContentHeader), Length(cContentHeader), HTTP_ADDREQ_FLAG_ADD);
    end;
    

    and then before the HTTPReqResp1.Execute or HTTPReqResp1.Send:

    HTTPReqResp1.OnBeforePost := BeforeRRPost;
    
    0 讨论(0)
提交回复
热议问题