Is there a trick to using an iterator with a subclass?

I have a subclass of URLConnection. I want to get the new URLConnection ResponseHeaders property like this from the documentation:

[code]Dim connection As New URLConnection

Var headers() As String
For Each header As String In connection.ResponseHeaders

The problem is, when I try to access myURLConnection.ResponseHeaders and iterate through the strings as per the documentation code, I get a TypeMismatchException. If I declare a regular URLConnection as per the sample code then it works as it should.

My guess is that I might need to do something differently to access the ResponseHeaders property given that I have subclassed URLConnection?

Bug in the docs, they should be Pairs, it only seems to work (by not breaking) as there is nothing in the list in that example.


[code]Var connection As New URLConnection

Var s As String = connection.SendSync(“GET”, “”, 5)

Var headers() As Pair
For Each header As Pair In connection.ResponseHeaders

Perfect. Thank you Julian! :slight_smile:

FYI: Still not fixed in the docs :wink:

Probably missed this one, seems to be happening quite often for simple/quick fixes <>

I just made a request: <>: array should be compatible to iterable interface

Because if you have code expecting an iterable interface, you can’t pass an array.