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

Bugfix: 修复 PSR-7 Response 用法 #2671

Merged
merged 1 commit into from
Mar 10, 2022
Merged

Bugfix: 修复 PSR-7 Response 用法 #2671

merged 1 commit into from
Mar 10, 2022

Conversation

overtrue
Copy link
Contributor

$response->getBody()->getContents() 并不能保证拿到完整内容,PSR-7 里的原话:

Each stream instance will have various capabilities: it can be read-only, write-only, or read-write. It can also allow arbitrary random access (seeking forwards or backwards to any location), or only sequential access (for example in the case of a socket, pipe, or callback-based stream).

Finally, StreamInterface defines a __toString() method to simplify retrieving or emitting the entire body contents at once.
-- https://www.php-fig.org/psr/psr-7/#13-streams

相关讨论:

`$response->getBody()->getContents()` 并不能保证拿到完整内容,PSR-7 里的原话:

> Each stream instance will have various capabilities: it can be read-only, write-only, or read-write. It can also allow arbitrary random access (seeking forwards or backwards to any location), or only sequential access (for example in the case of a socket, pipe, or callback-based stream).
>
> Finally, StreamInterface defines a __toString() method to simplify retrieving or emitting the entire body contents at once.
> -- https://www.php-fig.org/psr/psr-7/#13-streams

相关讨论:
- Nyholm/psr7#176
@onekb
Copy link

onekb commented Mar 10, 2022

+1

2 similar comments
@aa24615
Copy link

aa24615 commented Mar 10, 2022

+1

@zhanghangt
Copy link
Contributor

+1

@sy-records sy-records requested review from liu21st and yunwuxin March 10, 2022 02:56
@pengxuxu
Copy link

+1

3 similar comments
@xihuantudi
Copy link

+1

@xihuantudi
Copy link

+1

@xihuantudi
Copy link

+1

@liu21st liu21st merged commit d11b71a into top-think:6.0 Mar 10, 2022
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.

8 participants