请教关于http 的post请求,body为空的问题

LintyW 2017-03-31 09:46:39
发送的http请求,用抓包软件抓取后发现body没有字节,是空的。请教如何往http post请求的body里添加内容。
我写的代码如下:
idhtp1:=Tidhttp.create(nil);
idslhndlrscktpnsl1 := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
idslhndlrscktpnsl1.SSLOptions.Method:=sslvTLSv1;
idslhndlrscktpnsl1.SSLOptions.Mode:=sslmClient;
idhtp1.IOHandler := idslhndlrscktpnsl1;
idhtp1.Request.AcceptCharSet:='Accept-Charset=utf-8;';
idhtp1.Request.ContentType:='application/x-www-form-urlencoded; charset=UTF-8';
jsonPost:=SO();
ResponseStream1 := TStringStream.Create('');
RequestStream1 := TStringStream.Create('');
jsonPost.s['coupon']:=trim(edtYHQCode.Text);
jsonPost.s['sign']:=tmpStr;
tmpJsonStr:=jsonPost.AsString;
RequestStream1.WriteString(tmpJsonStr);
idhtp1.Post(httpUrl,RequestStream1,ResponseStream1);
json1 := SO(UTF8Decode(ResponseStream1.DataString));
...全文
5011 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
LintyW 2017-04-25
  • 打赏
  • 举报
回复
这么长时间了,结贴

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧