Skip to content
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

Fix | Rewinds the body if it is seekable #205

Merged
merged 3 commits into from
Apr 28, 2023

Conversation

Sammyjo20
Copy link
Member

This PR fixes an issue where if you called a body method on a response and then used a different one after, it would be an empty string. This was because the body() method wasn't rewinding the underlying stream.

This PR fixes this issue.

@what-the-diff
Copy link

what-the-diff bot commented Apr 28, 2023

PR Summary 🚀

  • Stream rewind after reading in body method 🔄
    The body method now rewinds the stream back to the start after reading it, ensuring no issues when reusing the stream.

  • New dtoOrFail() method added 💥
    A helpful dtoOrFail() method has been introduced, which throws a LogicException if the response fails instead of just returning null.

  • SaloonResponseTest improvements
    The SaloonResponseTest now checks that json(), object(), and xml() methods all return the expected results, while also rewinding the stream back to its original position for smooth, worry-free operation! 😄

Copy link
Member Author

@Sammyjo20 Sammyjo20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self review

@Sammyjo20 Sammyjo20 merged commit c054777 into v2 Apr 28, 2023
@Sammyjo20 Sammyjo20 deleted the feature/rewind-stream-when-using-body-method branch May 8, 2023 15:27
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.

1 participant