Skip to content

Comments

Fix | Rewinds the body if it is seekable#205

Merged
Sammyjo20 merged 3 commits intov2from
feature/rewind-stream-when-using-body-method
Apr 28, 2023
Merged

Fix | Rewinds the body if it is seekable#205
Sammyjo20 merged 3 commits intov2from
feature/rewind-stream-when-using-body-method

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