TsgcHTTPServer › Özellikler › ParseParams
Her isteğin sorgu dizesini ve form-urlencoded gövdesini ARequestInfo.Params içine ayrıştırır.
property ParseParams: Boolean read GetParseParams write SetParseParams;
True
ParseParams True (varsayılan) olduğunda, alttaki Indy HTTP sunucusu isteğin sorgu dizesini ve bir application/x-www-form-urlencoded POST gövdesi için form alanlarını da çözer, böylece her ad/değer çifti OnCommandGet / OnCommandOther içinde ARequestInfo.Params aracılığıyla kullanılabilir hale gelir. Sunucu çoğunlukla ARequestInfo.PostStream'den doğrudan okunan ham JSON veya ikili gövdeleri işliyorsa ve ek ayrıştırma boşa harcanan bir iş olacaksa, bu ayrıştırma adımını atlamak için False olarak ayarlayın.
oServer := TsgcHTTPServer.Create(nil);
oServer.ParseParams := true;
procedure OnCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo);
begin
AResponseInfo.ContentText := 'name=' + ARequestInfo.Params.Values['name'];
end;