Sample code for 30+ languages & platforms
Visual Basic 6.0

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 Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim rest As New ChilkatRest
Dim bTls As Long
bTls = 1
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = 0) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

'  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.

Dim respStream As New ChilkatStream
respStream.SinkFile = "qa_output/response_body.dat"
Dim bAutoSetCharset As Long
bAutoSetCharset = 1
Dim expectedStatus As Long
expectedStatus = 200
success = rest.SetResponseBodyStream(expectedStatus,bAutoSetCharset,respStream)
If (success = 0) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

'  Clear the response-stream destination previously configured, so subsequent full-request calls
'  return the response body normally instead of streaming it.
rest.ClearResponseBodyStream 

Debug.Print "Response body streaming cleared."