TsgcHTTPServer › プロパティ › ParseParams

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;

プロパティに戻る