Xojo Plugin
Xojo Plugin
Get a REST Response Header Value by Index
See more REST Examples
Demonstrates Rest.ResponseHdrValue, which returns the value of the response header at a zero-based index. The same index used with ResponseHdrName gives the corresponding field name.
Background. Response headers can be enumerated by index from 0 through NumResponseHeaders minus one, after ReadResponseHeader has been called.
Chilkat Xojo Plugin Downloads
Dim success As Boolean
success = False
Dim rest As New Chilkat.Rest
Dim bTls As Boolean
bTls = True
Dim bAutoReconnect As Boolean
bAutoReconnect = True
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = False) Then
System.DebugLog(rest.LastErrorText)
Return
End If
success = rest.SendReqNoBody("GET","/api/items/123")
If (success = False) Then
System.DebugLog(rest.LastErrorText)
Return
End If
Dim statusCode As Int32
statusCode = rest.ReadResponseHeader()
If (statusCode < 0) Then
System.DebugLog(rest.LastErrorText)
Return
End If
// Return the value of the response header at a zero-based index. Use the same index with
// ResponseHdrName to get the corresponding field name.
Dim numHeaders As Int32
numHeaders = rest.NumResponseHeaders
Dim i As Int32
For i = 0 To numHeaders - 1
Dim value As String
value = rest.ResponseHdrValue(i)
If (rest.LastMethodSuccess = False) Then
System.DebugLog(rest.LastErrorText)
Return
End If
System.DebugLog("Header " + Str(i) + " value: " + value)
Next