branch off v1 as R_1_7
[m6w6/ext-http] / tests / HttpMessage_008.phpt
1 --TEST--
2 HttpMessage::toMessageTypeObject()
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkver(5);
7 checkcls('HttpRequest');
8 ?>
9 --FILE--
10 <?php
11 echo "-TEST\n";
12
13 $b = HttpRequest::encodeBody(array("a"=>"b",1=>2),null);
14
15 $m = new HttpMessage;
16 $m->setType(HttpMessage::TYPE_REQUEST);
17 $m->setRequestMethod('POST');
18 $m->setRequestUrl("http://www.example.com");
19 $m->setHttpVersion('1.1');
20 $m->addHeaders(
21 array(
22 "Content-Type" => "application/x-www-form-urlencoded",
23 "Host" => "www.example.com",
24 "Content-Length"=> strlen($b),
25 )
26 );
27 $m->setBody($b);
28 $r = $m->toMessageTypeObject();
29 echo $m,"\n";
30 echo "Done\n";
31 ?>
32 --EXPECTF--
33 %aTEST
34 POST http://www.example.com HTTP/1.1
35 Content-Type: application/x-www-form-urlencoded
36 Host: www.example.com
37 Content-Length: 7
38
39 a=b&1=2
40
41 Done