File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,10 @@ public function __construct($args = []) {
3131 case 'POST ' :
3232 if ($ this ->_contentType () === 'application/json ' ) {
3333 $ this ->_properties = json_decode ($ this ->content (), 'array ' );
34- // } elseif ($_SERVER['CONTENT_TYPE'] === 'application/x-www-form-urlencoded') {
34+ } elseif ($ this ->_contentType () === 'multipart/form-data ' ) {
35+ $ this ->_properties = $ _REQUEST ;
3536 } else {
3637 $ this ->_properties = $ _POST ;
37- $ this ->_properties = $ _REQUEST ;
3838 }
3939 break ;
4040
Original file line number Diff line number Diff line change @@ -11,6 +11,28 @@ public function setUp() {
1111 $ this ->setupDb ($ this ->tip );
1212 }
1313
14+ public function testMultipartFormPost () {
15+ $ _REQUEST ['__url ' ] = 'test ' ;
16+ $ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
17+ $ _SERVER ['CONTENT_TYPE ' ] = 'multipart/form-data; separater blah blah ' ;
18+ $ _REQUEST ['data ' ] = 'blah ' ;
19+
20+ $ this ->tip ->service ('TestModel ' , []);
21+
22+ $ this ->tip ->router ()
23+ ->post ('test ' ,function ($ TestModel , $ Request ) {
24+ $ TestModel ->test = 'hi ' ;
25+ $ TestModel ->data = $ Request ->data ;
26+ echo $ TestModel ->json ();
27+ });
28+
29+ $ this ->ob ();
30+ $ this ->tip ->run ();
31+ $ check = $ this ->ob (false );
32+ $ this ->assertEquals (json_encode (['test ' => 'hi ' , 'data ' => 'blah ' ]), $ check );
33+ }
34+
35+
1436 public function testFormPost () {
1537 $ _REQUEST ['__url ' ] = 'test ' ;
1638 $ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
You can’t perform that action at this time.
0 commit comments