TsgcHTTPServer › プロパティ › ParseParams
すべてのリクエストのクエリ文字列と form-urlencoded 形式のボディを解析して ARequestInfo.Params に格納します。
property ParseParams: Boolean read GetParseParams write SetParseParams;
True
ParseParams が True(デフォルト)の場合、基盤となる Indy HTTP サーバーはリクエストのクエリ文字列を、また application/x-www-form-urlencoded の POST ボディの場合はフォームフィールドも併せてデコードし、OnCommandGet / OnCommandOther 内で ARequestInfo.Params を通じてすべての名前/値のペアを利用できるようにします。サーバーが主に生の JSON やバイナリボディを ARequestInfo.PostStream から直接読み取って処理する場合など、この解析処理が無駄になる場合は False に設定してこの解析ステップをスキップしてください。
oServer := TsgcHTTPServer.Create(nil);
oServer.ParseParams := true;
procedure OnCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo);
begin
AResponseInfo.ContentText := 'name=' + ARequestInfo.Params.Values['name'];
end;