Skip to content

Commit 9e88b9a

Browse files
committed
Fix: Correção de parse de queryParams no request.
1 parent 8d43ff7 commit 9e88b9a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/base/RALRequest.pas

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ TRALRequest = class(TRALHTTPHeaderInfo)
6767
FMethod: TRALMethod;
6868
FProtocol: StringRAL;
6969
FQuery: StringRAL;
70+
private
71+
procedure ParseQueryParams(const AValue: StringRAL);
7072
protected
7173
/// Grabs the full URL of the request
7274
function GetURL: StringRAL;
@@ -156,6 +158,20 @@ function TRALRequest.GetRequestText: StringRAL;
156158
Result := GetRequestEncText;
157159
end;
158160

161+
procedure TRALRequest.ParseQueryParams(const AValue: StringRAL);
162+
var
163+
sl: TStringList;
164+
begin
165+
sl := TStringList.Create;
166+
try
167+
sl.Delimiter := '&';
168+
sl.DelimitedText := AValue;
169+
Params.AppendParams(sl, rpkQUERY);
170+
finally
171+
FreeAndNil(sl);
172+
end;
173+
end;
174+
159175
function TRALRequest.GetURL: StringRAL;
160176
begin
161177
Result := LowerCase(FHttpVersion) + ':/' + FixRoute(FHost + '/' + FQuery);
@@ -169,7 +185,10 @@ procedure TRALRequest.SetQuery(const AValue: StringRAL);
169185

170186
vInt := Pos('?', FQuery);
171187
if vInt > 0 then
188+
begin
189+
ParseQueryParams(Copy(FQuery, vInt + 1, Length(FQuery)));
172190
Delete(FQuery, vInt, Length(FQuery));
191+
end;
173192

174193
FQuery := FixRoute(FQuery);
175194
end;

0 commit comments

Comments
 (0)