TsgcHTTPServer › Properties › ParseParams

ParseParams Property

Parses the query string and form-urlencoded body of every request into ARequestInfo.Params.

Syntax

property ParseParams: Boolean read GetParseParams write SetParseParams;

Default Value

True

Remarks

When ParseParams is True (the default), the underlying Indy HTTP server decodes the request's query string and, for an application/x-www-form-urlencoded POST body, the form fields as well, making every name/value pair available through ARequestInfo.Params inside OnCommandGet / OnCommandOther. Set it to False to skip this parsing step, for example when the server mostly handles raw JSON or binary bodies read directly from ARequestInfo.PostStream and the extra parsing would be wasted work.

Example


oServer := TsgcHTTPServer.Create(nil);
oServer.ParseParams := true;

procedure OnCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo;
  AResponseInfo: TIdHTTPResponseInfo);
begin
  AResponseInfo.ContentText := 'name=' + ARequestInfo.Params.Values['name'];
end;

Back to Properties