我有一个以表单形式附加到 IdHTTP 组件的 cookiesmanager。
var
XMLRqst : string;
XMLResponse : TStringStream;
XMLRequest : TStringStream;
...
begin
...
IdHTTP1.CookieManager.CookieCollection.Add;
IdHTTP1.CookieManager.CookieCollection[ IdHTTP1.CookieManager.CookieCollection.Count -1 ].CookieName := 'data';
IdHTTP1.CookieManager.CookieCollection[ IdHTTP1.CookieManager.CookieCollection.Count -1 ].Value := '<root user="yyy" company="xxxx">';
IdHTTP1.CookieManager.CookieCollection[ IdHTTP1.CookieManager.CookieCollection.Count -1 ].Path := '/';
...
XMLRequest := TStringStream.Create( XMLRqst, TEncoding.Unicode );
...
idHTTP1.Post( 'http://mysite/api', XMLRequest, XMLResponse );
idHTTP1.Disconnect;
我从来没有收到过“数据”cookie。
- 如何在 Delphi XE6 中通过 Indy 的 IdHTTP 组件使用 http post 正确发送 cookie?