@@ -86,13 +86,38 @@ public function testPut_mime_save()
86
86
87
87
list ($ ret , $ err ) = Qiniu_RS_Stat ($ this ->client , $ this ->bucket , $ key );
88
88
$ this ->assertNull ($ err );
89
- $ this ->assertEquals ($ ret ['mimeType ' ], 'application/x-httpd- php ' );
89
+ $ this ->assertEquals ($ ret ['mimeType ' ], 'application/x-php ' );
90
90
var_dump ($ ret );
91
91
92
92
$ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
93
93
$ this ->assertNull ($ err );
94
94
}
95
95
96
+ public function testPut_mimetype () {
97
+ $ key = 'testPut_mimetype ' . getTid ();
98
+ $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
99
+ $ scope = $ this ->bucket . ": " . $ key ;
100
+
101
+ $ putPolicy = new Qiniu_RS_PutPolicy ($ scope );
102
+ $ putPolicy ->ReturnBody = '{"key":$(key),"mimeType":$(mimeType)} ' ;
103
+ $ upToken = $ putPolicy ->Token (null );
104
+
105
+ $ putExtra = new Qiniu_PutExtra ();
106
+ $ putExtra ->MimeType = 'image/jpg ' ;
107
+
108
+ list ($ ret1 , $ err1 ) = Qiniu_PutFile ($ upToken , $ key , __file__, $ putExtra );
109
+ var_dump ($ ret1 );
110
+ $ this ->assertNull ($ err1 );
111
+ $ this ->assertEquals ($ ret1 ['mimeType ' ], 'image/jpg ' );
112
+
113
+ list ($ ret2 , $ err2 ) = Qiniu_Put ($ upToken , $ key , "hello world " , $ putExtra );
114
+ var_dump ($ ret2 );
115
+ $ this ->assertNull ($ err2 );
116
+ $ this ->assertEquals ($ ret2 ['mimeType ' ], 'image/jpg ' );
117
+
118
+ $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
119
+ }
120
+
96
121
public function testPut_exclusive ()
97
122
{
98
123
$ key = 'testPut_exclusive ' . getTid ();
0 commit comments