Changed FormField handling back to urlencoded format.
This commit is contained in:
parent
76cd385462
commit
be7615f7dc
|
@ -23,9 +23,7 @@ unit URestemplateApp;
|
|||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, CustApp,
|
||||
IniFiles, jsonparser, JTemplate,
|
||||
UFilter, IdHTTP, IdMultipartFormData;
|
||||
Classes, SysUtils, CustApp, IniFiles, jsonparser, JTemplate, UFilter, IdHTTP;
|
||||
|
||||
type
|
||||
|
||||
|
@ -55,7 +53,7 @@ type
|
|||
FHttp: TRestHTTP;
|
||||
FRequest: TRestRequest;
|
||||
FContent: TStringList;
|
||||
FFormFields: TIdMultiPartFormDataStream;
|
||||
FFormFields: TStrings;
|
||||
FFilters: TFilterList;
|
||||
FBeautify: Boolean;
|
||||
FURL: String;
|
||||
|
@ -328,18 +326,10 @@ begin
|
|||
end;
|
||||
|
||||
procedure TRestemplateApplication.CmdFormField(AData: String);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i := 1;
|
||||
FParser.Content := AData;
|
||||
FParser.Replace;
|
||||
AData := FParser.Content;
|
||||
|
||||
while (i < Length(AData)) and (AData[i] <> '=') do
|
||||
Inc(i);
|
||||
|
||||
FFormFields.AddFormField(Copy(AData, 1, i - 1), Copy(AData, i + 1, Length(AData)));
|
||||
FFormFields.Add(FParser.Content);
|
||||
end;
|
||||
|
||||
procedure TRestemplateApplication.CmdProxy(AData: String);
|
||||
|
@ -400,11 +390,9 @@ begin
|
|||
FRequest.Prepare;
|
||||
FHttp.Request := FRequest;
|
||||
FHttp.HTTPOptions := FHttp.HTTPOptions + [hoNoProtocolErrorException];
|
||||
if FFormFields.Size > 0 then
|
||||
begin
|
||||
FHttp.Request.ContentType := FFormFields.RequestContentType;
|
||||
FHttp.Perform(FMethod, AURL, FFormFields, response);
|
||||
end else
|
||||
if SameText('POST', FMethod) and (FFormFields.Count > 0) then
|
||||
FHttp.Post(AURL, FFormFields, response)
|
||||
else
|
||||
FHttp.Perform(FMethod, AURL, request, response);
|
||||
except
|
||||
on E: Exception do
|
||||
|
@ -559,7 +547,7 @@ begin
|
|||
|
||||
FSessionIni := TIniFile.Create(FConfigDir + 'session.ini');
|
||||
FContent := TStringList.Create;
|
||||
FFormFields := TIdMultiPartFormDataStream.Create;
|
||||
FFormFields := TStringList.Create;
|
||||
FHttp := TRestHTTP.Create(nil);
|
||||
FRequest := TRestRequest.Create(FHttp);
|
||||
FRequest.RawHeaders.AddValue('User-Agent', 'Mozilla/4.0 (compatible; restemplate ' + VersionInfo.GetProductVersionString + ')');
|
||||
|
|
Loading…
Reference in New Issue