99 common PSR-7 interfaces:
1010
1111 ``` php
12- // old
13- $browser->get($uri)->then(function (Response $response) {
14- echo 'Test: ' . $response->getHeader('X-Test');
15- echo 'Body: ' . $response->getBody();
16- });
17-
18- // new
19- $browser->get($uri)->then(function (ResponseInterface $response) {
20- if ($response->hasHeader('X-Test')) {
21- echo 'Test: ' . $response->getHeaderLine('X-Test');
22- }
23- echo 'Body: ' . $response->getBody();
24- });
25- ```
12+ // old
13+ $browser->get($uri)->then(function (Response $response) {
14+ echo 'Test: ' . $response->getHeader('X-Test');
15+ echo 'Body: ' . $response->getBody();
16+ });
17+
18+ // new
19+ $browser->get($uri)->then(function (ResponseInterface $response) {
20+ if ($response->hasHeader('X-Test')) {
21+ echo 'Test: ' . $response->getHeaderLine('X-Test');
22+ }
23+ echo 'Body: ' . $response->getBody();
24+ });
25+ ```
2626
2727* Feature: Add streaming API
2828 (#56 by @clue )
2929
3030 ``` php
31- $browser = $browser->withOptions(array('streaming' => true));
32- $browser->get($uri)->then(function (ResponseInterface $response) {
33- $response->getBody()->on('data', function($chunk) {
34- echo $chunk . PHP_EOL;
35- });
36- });
37- ```
31+ $browser = $browser->withOptions(array('streaming' => true));
32+ $browser->get($uri)->then(function (ResponseInterface $response) {
33+ $response->getBody()->on('data', function($chunk) {
34+ echo $chunk . PHP_EOL;
35+ });
36+ });
37+ ```
3838
3939* Remove / BC break: Remove ` Browser::resolve() ` because it's now fully decoupled
4040 (#55 by @clue )
@@ -43,8 +43,8 @@ $browser->get($uri)->then(function (ResponseInterface $response) {
4343 instead:
4444
4545 ``` bash
46- $ composer require rize/uri-template
47- ```
46+ $ composer require rize/uri-template
47+ ```
4848
4949* Use clue/block-react and new Promise API in order to simplify tests
5050 (#53 by @clue )
@@ -64,36 +64,36 @@ $ composer require rize/uri-template
6464 ([ #48 ] ( https://github.com/clue/php-buzz-react/pull/48 ) )
6565
6666 ``` php
67- // now correctly returns "http://example.com/path"
68- // instead of previous "http://example.com//path"
69- $browser = $browser->withBase('http://example.com/');
70- echo $browser->resolve('{+path}', array('path' => '/path'));
71-
72- // now correctly returns "http://example.com/path?q=test"
73- // instead of previous "http://example.com/path/?q=test"
74- $browser = $browser->withBase('http://example.com/path');
75- echo $browser->resolve('{?q}', array('q' => 'test'));
76- ```
67+ // now correctly returns "http://example.com/path"
68+ // instead of previous "http://example.com//path"
69+ $browser = $browser->withBase('http://example.com/');
70+ echo $browser->resolve('{+path}', array('path' => '/path'));
71+
72+ // now correctly returns "http://example.com/path?q=test"
73+ // instead of previous "http://example.com/path/?q=test"
74+ $browser = $browser->withBase('http://example.com/path');
75+ echo $browser->resolve('{?q}', array('q' => 'test'));
76+ ```
7777
7878## 0.4.0 (2015-08-09)
7979
8080* Feature: Resolve relative URIs, add withBase() and resolve()
8181 ([ #41 ] ( https://github.com/clue/php-buzz-react/pull/41 ) , [ #44 ] ( https://github.com/clue/php-buzz-react/pull/44 ) )
8282
8383 ``` php
84- $browser = $browser->withBase('http://example.com/');
85- $browser->post('/');
86- ```
84+ $browser = $browser->withBase('http://example.com/');
85+ $browser->post('/');
86+ ```
8787
8888* Feature: Resolve URI template placeholders according to RFC 6570
8989 ([ #42 ] ( https://github.com/clue/php-buzz-react/pull/42 ) , [ #44 ] ( https://github.com/clue/php-buzz-react/pull/44 ) )
9090
9191 ``` php
92- $browser->post($browser->resolve('/{+path}{?version}', array(
93- 'path' => 'demo.json',
94- 'version' => '4'
95- )));
96- ```
92+ $browser->post($browser->resolve('/{+path}{?version}', array(
93+ 'path' => 'demo.json',
94+ 'version' => '4'
95+ )));
96+ ```
9797
9898* Feature: Resolve and follow redirects to relative URIs
9999 ([ #45 ] ( https://github.com/clue/php-buzz-react/pull/45 ) )
@@ -103,12 +103,12 @@ $browser->post($browser->resolve('/{+path}{?version}', array(
103103 ([ #37 ] ( https://github.com/clue/php-buzz-react/pull/37 ) )
104104
105105 ``` php
106- // old
107- $browser->request('GET', 'http://www.example.com/');
108-
109- // new
110- $browser->send(new Request('GET', 'http://www.example.com/'));
111- ```
106+ // old
107+ $browser->request('GET', 'http://www.example.com/');
108+
109+ // new
110+ $browser->send(new Request('GET', 'http://www.example.com/'));
111+ ```
112112
113113* Feature / Bc break: Enforce absolute URIs via new Uri class
114114 ([ #40 ] ( https://github.com/clue/php-buzz-react/pull/40 ) , [ #44 ] ( https://github.com/clue/php-buzz-react/pull/44 ) )
0 commit comments