@@ -86,13 +86,38 @@ public function testPut_mime_save()
8686
8787 list ($ ret , $ err ) = Qiniu_RS_Stat ($ this ->client , $ this ->bucket , $ key );
8888 $ this ->assertNull ($ err );
89- $ this ->assertEquals ($ ret ['mimeType ' ], 'application/x-httpd- php ' );
89+ $ this ->assertEquals ($ ret ['mimeType ' ], 'application/x-php ' );
9090 var_dump ($ ret );
9191
9292 $ err = Qiniu_RS_Delete ($ this ->client , $ this ->bucket , $ key );
9393 $ this ->assertNull ($ err );
9494 }
9595
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+
96121 public function testPut_exclusive ()
97122 {
98123 $ key = 'testPut_exclusive ' . getTid ();
0 commit comments