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

Improve unserializable response handling #111

Merged
merged 6 commits into from
Jan 30, 2018

Conversation

sebastiandedeyne
Copy link
Member

Kind of fixes #102

I'd rather treat a case like this as an uncached response, but since ResponseCache::getCachedResponseFor has Response as a strict return type, we can't modify the behaviour without a breaking change.

I propose we provide a clear exception until we work on the next major version.


use Exception;

class CouldntUnserialize extends Exception
Copy link
Member

Choose a reason for hiding this comment

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

Rename this to CouldNotUnserialize

@@ -46,4 +47,12 @@ public function it_can_serialize_and_unserialize_a_response()

$this->assertEquals('testValue', $unserializedResponse->headers->get('testHeader'));
}

/** @test */
public function it_throws_when_something_something_else_than_a_response_is_unserialized()
Copy link
Member

Choose a reason for hiding this comment

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

Rename to it_throws_an_exception_when_something_else_than_a_response_is_unserialized

@sebastiandedeyne sebastiandedeyne merged commit b46de0e into master Jan 30, 2018
@sebastiandedeyne sebastiandedeyne deleted the improve-unserializable-response-handling branch January 30, 2018 10:25
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.

Can not build response if cache was deleted while reading cache data
2 participants