Lianja
Lianja
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 Lianja Downloads
llSuccess = .F.
loRest = createobject("CkRest")
llBTls = .T.
llBAutoReconnect = .T.
llSuccess = loRest.Connect("example.com",443,llBTls,llBAutoReconnect)
if (llSuccess = .F.) then
? loRest.LastErrorText
release loRest
return
endif
// 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.
loRespStream = createobject("CkStream")
loRespStream.SinkFile = "qa_output/response_body.dat"
llBAutoSetCharset = .T.
lnExpectedStatus = 200
llSuccess = loRest.SetResponseBodyStream(lnExpectedStatus,llBAutoSetCharset,loRespStream)
if (llSuccess = .F.) then
? loRest.LastErrorText
release loRest
release loRespStream
return
endif
// Clear the response-stream destination previously configured, so subsequent full-request calls
// return the response body normally instead of streaming it.
loRest.ClearResponseBodyStream()
? "Response body streaming cleared."
release loRest
release loRespStream