Hhmm,
das heißt, dass diese Funktion einfach nur ein Fehler ist?
unit System.Net.HttpClient:
Delphi-Quellcode:
function THTTPClient.IsAutoRedirectWithGET(const ARequest: THTTPRequest; const AResponse: THTTPResponse): Boolean;
var
LRedirWithGet: THTTPRedirectsWithGET;
LMethod: string;
begin
// POST:
// * 303 must be redirected to GET according spec
// * 301, 302, 307 erroneously may be redirected to GET too
// PUT, DELETE:
// * 303 must be redirected to GET according spec
Result := False;
if not IsAutoRedirect(AResponse) then
Exit;
LRedirWithGet := RedirectsWithGET;
LMethod := ARequest.GetMethodString;
if SameText(LMethod, sHTTPMethodPost) then
case AResponse.GetStatusCode of
301: Result := THTTPRedirectWithGET.Post301 in LRedirWithGet;
302: Result := THTTPRedirectWithGET.Post302 in LRedirWithGet;
303: Result := THTTPRedirectWithGET.Post303 in LRedirWithGet;
307: Result := THTTPRedirectWithGET.Post307 in LRedirWithGet;
308: Result := THTTPRedirectWithGET.Post308 in LRedirWithGet;
end
else if SameText(LMethod, sHTTPMethodPut) then
case AResponse.GetStatusCode of
301: Result := THTTPRedirectWithGET.Put301 in LRedirWithGet;
302: Result := THTTPRedirectWithGET.Put302 in LRedirWithGet;
303: Result := THTTPRedirectWithGET.Put303 in LRedirWithGet;
307: Result := THTTPRedirectWithGET.Put307 in LRedirWithGet;
308: Result := THTTPRedirectWithGET.Put308 in LRedirWithGet;
end
else if SameText(LMethod, sHTTPMethodDelete) then
case AResponse.GetStatusCode of
301: Result := THTTPRedirectWithGET.Delete301 in LRedirWithGet;
302: Result := THTTPRedirectWithGET.Delete302 in LRedirWithGet;
303: Result := THTTPRedirectWithGET.Delete303 in LRedirWithGet;
307: Result := THTTPRedirectWithGET.Delete307 in LRedirWithGet;
308: Result := THTTPRedirectWithGET.Delete308 in LRedirWithGet;
end;
end;