Skip to content

Commit 304502e

Browse files
fix typo (#99)
* fix: psr 风格中withbody 中传入 new bufferstream 不支持直接构造写入,改成了要调用write写入 * update readme Co-authored-by: sy-records <[email protected]>
1 parent 25f2dba commit 304502e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README-EN.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,15 @@ echo SaberGM::get($uri, ['proxy' => 'socks5://127.0.0.1:1086'])->body;
132132
### PSR Style
133133

134134
```php
135+
$bufferStream = new BufferStream();
136+
$bufferStream->write(json_encode(['foo' => 'bar']));
135137
$response = SaberGM::psr()
136138
->withMethod('POST')
137139
->withUri(new Uri('http://httpbin.org/post?foo=bar'))
138140
->withQueryParams(['foo' => 'option is higher-level than uri'])
139141
->withHeader('content-type', ContentType::JSON)
140-
->withBody(new BufferStream(json_encode(['foo' => 'bar'])))
142+
->withBody($bufferStream)
141143
->exec()->recv();
142-
143144
echo $response->getBody();
144145
```
145146

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ go(function () {
106106
- <a href="#掩码表">掩码表</a>
107107
- <a href="#异常自定义处理函数">异常自定义处理函数</a>
108108
- <a href="#road-map">Road Map</a>
109-
- <a href="#why-not-http2-?">Why not Http2 ?</a>
109+
- <a href="#why-not-http2-">Why not Http2 ?</a>
110110
- <a href="#ide-helper">IDE Helper</a>
111111
- <a href="#重中之重">重中之重</a>
112112
- <a href="#附录">附录</a>
@@ -311,14 +311,15 @@ echo $res;
311311
### PSR风格
312312

313313
```php
314+
$bufferStream = new BufferStream();
315+
$bufferStream->write(json_encode(['foo' => 'bar']));
314316
$response = SaberGM::psr()
315317
->withMethod('POST')
316318
->withUri(new Uri('http://httpbin.org/post?foo=bar'))
317319
->withQueryParams(['foo' => 'option is higher-level than uri'])
318320
->withHeader('content-type', ContentType::JSON)
319-
->withBody(new BufferStream(json_encode(['foo' => 'bar'])))
321+
->withBody($bufferStream)
320322
->exec()->recv();
321-
322323
echo $response->getBody();
323324
```
324325

@@ -709,7 +710,7 @@ As the main HTTP/2 benefit is that it allows multiplexing many requests within a
709710

710711
对于底层Swoole相关类的IDE提示则需要引入eaglewu的[swoole-ide-helper](https://github.com/eaglewu/swoole-ide-helper)(composer在dev环境下会默认安装), 但是该项目为手动维护, 不太完整, 也可以使用[swoft-ide-helper](https://github.com/swoft-cloud/swoole-ide-helper)或:
711712

712-
**Swoole官方的[ide-helper](https://github.com/swoole/ide-helper/)并运行`php dump.php`生成一下.**
713+
**Swoole官方的[ide-helper](https://github.com/swoole/ide-helper).**
713714

714715
<br>
715716

0 commit comments

Comments
 (0)