TsgcHTTP2ClientYöntemler › Patch

Patch Yöntem

Hedef kaynağa kısmi bir değişiklik uygulayarak senkron bir HTTP/2 PATCH gerçekleştirir.

Aşırı Yüklemeler

Aşırı Yükleme 1

Sözdizimi

function Patch(const aURL: string; const aSource: TStream): string;

Parametreler

NameTypeAçıklama
aURLconst stringKısmen güncellenecek kaynağın mutlak URL'si.
aSourceconst TStreamPatch belgesini tutan akış (örneğin bir JSON Patch veya JSON Merge Patch gövdesi).

Dönüş Değeri

Sunucu tarafından döndürülen ve dize olarak kodu çözülen yanıt gövdesi. (string)

Remarks

PUT'tan farklı olarak, PATCH yalnızca değişmesi gereken alanları gönderir. Request.ContentType'ın sunucu tarafından beklenen patch formatıyla eşleştiğinden emin olun (örneğin application/json-patch+json veya application/merge-patch+json).

Örnek

oBody := TStringStream.Create('{"email":"new@example.com"}');
try
  oClient.Request.ContentType := 'application/merge-patch+json';
  vResponse := oClient.Patch('https://api.example.com/users/42', oBody);
finally
  oBody.Free;
end;

Overload 2

Sözdizimi

procedure Patch(const aURL: string; const aSource: TStream; const aResponseContent: TStream);

Parametreler

NameTypeAçıklama
aURLconst stringKısmen güncellenecek kaynağın mutlak URL'si.
aSourceconst TStreamYama yükünü içeren stream.
aResponseContentconst TStreamSunucudan gelen ham yanıtı yakalayan stream.

Remarks

Tamamen akıtılmış varyant. Patch belgesi veya yanıt temsili, bir dize gidiş dönüşünün israf olacağı kadar büyük olduğunda uygundur.

Örnek

oIn := TFileStream.Create('patch.json', fmOpenRead);
oOut := TMemoryStream.Create;
try
  oClient.Patch('https://api.example.com/users/42', oIn, oOut);
finally
  oOut.Free;
  oIn.Free;
end;

Yöntemlere Dön