Skip to content

fix: avoid null exception when received body is empty but recorded body isn't #59

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

Merged

Conversation

jhonny-apiiro
Copy link
Contributor

@jhonny-apiiro jhonny-apiiro commented Feb 2, 2024

Firstly, thank you so much for creating and maintaining this library 🙏
I've been a VCR user in ruby, and have been looking for a comparable library for c# for a while.
Thank you for your hard work!

I encountered the issue below when using VCR in conjunction with the refit library (https://github.com/reactiveui/refit).
Refit would automatically assign an empty body to requests, unless defined otherwise.
I would then get null ref exception when trying to record a new request onto an existing cassette.

Description

Closes #58

Testing

Unit test added

Pull Request Type

Please select the option(s) that are relevant to this PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement (fixing a typo, updating readme, renaming a variable name, etc)

@jhonny-apiiro jhonny-apiiro requested a review from a team February 2, 2024 15:43
@nwithan8
Copy link
Contributor

nwithan8 commented Feb 2, 2024

Hello, thanks for reaching out and for the kind words!

Good catch on this, we'll get it patched ASAP.

@nwithan8 nwithan8 force-pushed the fix-null-ref-exception-on-empty-body branch from ae7d981 to 821c898 Compare February 2, 2024 20:00
@nwithan8 nwithan8 merged commit 8db019f into EasyPost:master Feb 2, 2024
@jhonny-apiiro jhonny-apiiro deleted the fix-null-ref-exception-on-empty-body branch February 12, 2024 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MatchRules().ByBody() NullReferenceException when the recorded body is not empty, and the received body is an empty string
2 participants