Delphi DLL
Delphi DLL
Clear a REST Response Body Stream Destination
See more REST Examples
Demonstrates Rest.ClearResponseBodyStream, which removes a response-stream destination previously configured with SetResponseBodyStream.
The file paths are relative to the application's current working directory. Absolute paths may also be used. Supply the paths appropriate to your own environment.
Background. Clearing the destination restores normal behavior, in which the full-request convenience methods return the response body rather than streaming it.
Chilkat Delphi DLL Downloads
var
success: Boolean;
rest: HCkRest;
bTls: Boolean;
bAutoReconnect: Boolean;
respStream: HCkStream;
bAutoSetCharset: Boolean;
expectedStatus: Integer;
begin
success := False;
rest := CkRest_Create();
bTls := True;
bAutoReconnect := True;
success := CkRest_Connect(rest,'example.com',443,bTls,bAutoReconnect);
if (success = False) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
// The file paths are relative to the application's current working directory. Absolute paths
// may also be used. Supply the paths appropriate to your own environment.
respStream := CkStream_Create();
CkStream_putSinkFile(respStream,'qa_output/response_body.dat');
bAutoSetCharset := True;
expectedStatus := 200;
success := CkRest_SetResponseBodyStream(rest,expectedStatus,bAutoSetCharset,respStream);
if (success = False) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
// Clear the response-stream destination previously configured, so subsequent full-request calls
// return the response body normally instead of streaming it.
CkRest_ClearResponseBodyStream(rest);
Memo1.Lines.Add('Response body streaming cleared.');
CkRest_Dispose(rest);
CkStream_Dispose(respStream);