Skip to content

Conversation

xprotocol-bot
Copy link

No description provided.

@dunglas
Copy link
Member

dunglas commented Apr 19, 2022

Could you add a test please? Also, isn't it possible to prevent the call to isEmpty() by just checking the return value of getContent()?

@xprotocol-bot
Copy link
Author

Hi. Yes I've just did that.
My old approach based on Dingo\Api\Http\Response and that one based on an old version of \Symfony\Component\HttpFoundation\Response which still allows $content to be null. And that how the bug happened.

Now current version of \Symfony\Component\HttpFoundation\Response enforce return type of getContent must be string|false so I've just updated the PR following that. And this fix will still work for the old version of \Symfony\Component\HttpFoundation\Response

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
@xprotocol-bot
Copy link
Author

Hi. Looks like one of the checks is stucked?

@derrabus
Copy link
Member

I'm not sure if this if the correct fix. If getContent() returns false, this usually does not mean that there is no content. It means that the content is generated when sending the response.

@xprotocol-bot
Copy link
Author

I'm not sure if this if the correct fix. If getContent() returns false, this usually does not mean that there is no content. It means that the content is generated when sending the response.

Is that case handled in: https://github.com/symfony/psr-http-message-bridge/blob/main/Factory/PsrHttpFactory.php#L136? And yeah I started to think that this might not be necessary because I got the bug because of the behavior of Dingo\Api\Http\Response when it returns 304 status code and empty content. And this library might not be responsible for handling such case.

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.

3 participants