Tcl
Tcl
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 Tcl Downloads
load ./chilkat.dll
set success 0
set rest [new_CkRest]
set bTls 1
set bAutoReconnect 1
set success [CkRest_Connect $rest "example.com" 443 $bTls $bAutoReconnect]
if {$success == 0} then {
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
exit
}
# 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.
set respStream [new_CkStream]
CkStream_put_SinkFile $respStream "qa_output/response_body.dat"
set bAutoSetCharset 1
set expectedStatus 200
set success [CkRest_SetResponseBodyStream $rest $expectedStatus $bAutoSetCharset $respStream]
if {$success == 0} then {
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
delete_CkStream $respStream
exit
}
# Clear the response-stream destination previously configured, so subsequent full-request calls
# return the response body normally instead of streaming it.
CkRest_ClearResponseBodyStream $rest
puts "Response body streaming cleared."
delete_CkRest $rest
delete_CkStream $respStream