Config.w32 chack for both instances of event.h
[m6w6/ext-http] / tests / client011.phpt
1 --TEST--
2 client history
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 skip_client_test();
7 ?>
8 --FILE--
9 <?php
10
11 include "helper/server.inc";
12
13 echo "Test\n";
14
15 server("env.inc", function($port) {
16 $body = new http\Message\Body;
17 $body->append("foobar");
18
19 $request = new http\Client\Request;
20 $request->setBody($body);
21 $request->setRequestMethod("POST");
22 $request->setRequestUrl("http://localhost:$port");
23
24 $client = new http\Client;
25 $client->recordHistory = true;
26
27 $client->enqueue($request)->send();
28 echo $client->getHistory()->toString(true);
29
30 $client->requeue($request)->send();
31 echo $client->getHistory()->toString(true);
32 });
33 ?>
34 Done
35 --EXPECTF--
36 Test
37 POST http://localhost:%d/ HTTP/1.1
38 Content-Length: 6
39
40 foobar
41 HTTP/1.1 200 OK
42 Accept-Ranges: bytes
43 X-Request-Content-Length: 6
44 X-Original-Transfer-Encoding: chunked
45 Content-Length: 19
46
47 string(6) "foobar"
48
49 POST http://localhost:%d/ HTTP/1.1
50 Content-Length: 6
51
52 foobar
53 HTTP/1.1 200 OK
54 Accept-Ranges: bytes
55 X-Request-Content-Length: 6
56 X-Original-Transfer-Encoding: chunked
57 Content-Length: 19
58
59 string(6) "foobar"
60
61 POST http://localhost:%d/ HTTP/1.1
62 Content-Length: 6
63
64 foobar
65 HTTP/1.1 200 OK
66 Accept-Ranges: bytes
67 X-Request-Content-Length: 6
68 X-Original-Transfer-Encoding: chunked
69 Content-Length: 19
70
71 string(6) "foobar"
72
73 Done