Skip to content

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

Merged
liu21st merged 1 commit into
top-think:6.0from
overtrue:patch-1
Mar 10, 2022
Merged

Bugfix: 修复 PSR-7 Response 用法#2671
liu21st merged 1 commit into
top-think:6.0from
overtrue:patch-1

Conversation

@overtrue

Copy link
Copy Markdown
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

onekb commented Mar 10, 2022

Copy link
Copy Markdown

+1

2 similar comments
@aa24615

aa24615 commented Mar 10, 2022

Copy link
Copy Markdown

+1

@zhanghangt

Copy link
Copy Markdown
Contributor

+1

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

Copy link
Copy Markdown

+1

3 similar comments
@xihuantudi

Copy link
Copy Markdown

+1

@xihuantudi

Copy link
Copy Markdown

+1

@xihuantudi

Copy link
Copy Markdown

+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