I just started using this library today, but I think I hit a small bug in Interaction: I was unable to save the status code and response headers when recording. Here's what I found:
When finished recording, Session.persist calls down to Interaction.dictionary, which checks if response is a HTTPURLResponse. If it is, it records the headers and status code for the response:
if let httpResponse = response as? HTTPURLResponse { …
However, this is checking if the response is a DVR.HTTPURLResponse, not a Foundation.HTTPURLResponse. Since DVR.HTTPURLResponse is only get initialized from cassette dictionaries, this condition should never be true.
I changed HTTPURLResponse to Foundation.HTTPURLResponse and was able to record status code / headers successfully.
Testing
Confirmed that this doesn't affect existing tests.
I just started using this library today, but I think I hit a small bug in
Interaction
: I was unable to save the status code and response headers when recording. Here's what I found:When finished recording,
Session.persist
calls down toInteraction.dictionary
, which checks ifresponse
is aHTTPURLResponse
. If it is, it records the headers and status code for the response:However, this is checking if the response is a
DVR.HTTPURLResponse
, not aFoundation.HTTPURLResponse
. SinceDVR.HTTPURLResponse
is only get initialized from cassette dictionaries, this condition should never be true.I changed
HTTPURLResponse
toFoundation.HTTPURLResponse
and was able to record status code / headers successfully.Testing
Confirmed that this doesn't affect existing tests.