-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple requests for the same url #37
Conversation
Thanks @haitaoli, this looks interesting! I will review and get back to you. |
The replaying:(BOOL) parameter makes the logic a little complex. What if instead there was no replaying parameter? Looks like that would be possible if |
VCRURLConnection/VCRCassette.m
Outdated
__block VCRRecording *recording = [self.responseDictionary objectForKey:key]; | ||
- (VCRRecording *)recordingForRequestKey:(VCRRequestKey *)key replaying:(BOOL)replaying { | ||
__block VCRRecording *recording; | ||
__block NSMutableArray *recordings = [self.responseDictionary objectForKey:key]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see recordings
getting mutated in a block, so this won't need the __block
declaration.
Cycling through all recordings might not be the ideal behavior. If replay runs out of recordings then something is wrong. In that case the latest response probably makes more sense. |
Got it - given that it's used for both recording and replaying, what you have makes sense! So then the only outstanding item is the extra __block declaration and this is good to go. Thanks again for this contribution! |
Removed uncessary |
@dstnbrkr thanks for merging it. Do you have plan to release a new version? |
@haitaoli all set! (just shipped 0.2.3) |
Great! Thank you. |
Summary
This PR addresses issue #33.
If
VCR
is in both recording and replaying mode, the replayed recording is added back to the queue. This behavior doesn't make a difference when there is only one recording per url. But when there are multiple responses, this creates a "loop". For example, responsesA
andB
are in the array, the replay sequence becomesA
,B
,A
,B
etc. IfVCR
is only in replay mode, then the replayed sequence isA
,B
,B
,B
...