* Added variable support for POST content

This commit is contained in:
Andreas Schneider 2015-09-17 16:20:13 +02:00
parent 3665c0a6b5
commit 4f048a3d02
1 changed files with 18 additions and 4 deletions

View File

@ -98,13 +98,21 @@ var
begin begin
parser.Content := AURL; parser.Content := AURL;
parser.Replace; parser.Replace;
writeln('Calling ', parser.Content); AURL := parser.Content;
writeln('Calling ', AURL);
{$ifdef use_synapse} {$ifdef use_synapse}
if content.Count > 0 then if content.Count > 0 then
content.SaveToStream(http.Document); begin
// Variable replacement
parser.Content := content.Text;
parser.Replace;
content.Text .= parser.Content;
if http.HTTPMethod(method, parser.Content) then content.SaveToStream(http.Document);
end;
if http.HTTPMethod(method, AURL) then
begin begin
writeln; writeln;
writeln('Status: ', http.ResultCode); writeln('Status: ', http.ResultCode);
@ -130,13 +138,19 @@ begin
if content.Count > 0 then if content.Count > 0 then
begin begin
request := TMemoryStream.Create; request := TMemoryStream.Create;
// Variable replacement
parser.Content := content.Text;
parser.Replace;
content.Text := parser.Content;
content.SaveToStream(request); content.SaveToStream(request);
request.Position := 0; request.Position := 0;
http.RequestBody := request; http.RequestBody := request;
end; end;
try try
http.HTTPMethod(method, parser.Content, response, []); http.HTTPMethod(method, AURL, response, []);
except except
on E: Exception do on E: Exception do
begin begin