diff --git a/restemplate.lpr b/restemplate.lpr index 3e162df..57d7a92 100644 --- a/restemplate.lpr +++ b/restemplate.lpr @@ -98,13 +98,21 @@ var begin parser.Content := AURL; parser.Replace; - writeln('Calling ', parser.Content); + AURL := parser.Content; + writeln('Calling ', AURL); {$ifdef use_synapse} 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 writeln; writeln('Status: ', http.ResultCode); @@ -130,13 +138,19 @@ begin if content.Count > 0 then begin request := TMemoryStream.Create; + + // Variable replacement + parser.Content := content.Text; + parser.Replace; + content.Text := parser.Content; + content.SaveToStream(request); request.Position := 0; http.RequestBody := request; end; try - http.HTTPMethod(method, parser.Content, response, []); + http.HTTPMethod(method, AURL, response, []); except on E: Exception do begin