public function testParseInvalid404()
 {
     $response = new ResponseCore(array(), null, 200);
     $result = new BodyResult($response);
     $this->assertTrue($result->isOK());
     $this->assertEquals($result->getData(), "");
 }
Beispiel #2
0
 /**
  * 获得Object内容
  *
  * @param string $bucket  bucket名称
  * @param string $object  object名称
  * @param array  $options 该参数中必须设置ALIOSS::OSS_FILE_DOWNLOAD,ALIOSS::OSS_RANGE可选,可以根据实际情况设置;如果不设置,默认会下载全部内容
  *
  * @return string
  */
 public function getObject($bucket, $object, $options = null)
 {
     $this->precheckCommon($bucket, $object, $options);
     $options[self::OSS_BUCKET] = $bucket;
     $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
     $options[self::OSS_OBJECT] = $object;
     if (isset($options[self::OSS_LAST_MODIFIED])) {
         $options[self::OSS_HEADERS][self::OSS_IF_MODIFIED_SINCE] = $options[self::OSS_LAST_MODIFIED];
         unset($options[self::OSS_LAST_MODIFIED]);
     }
     if (isset($options[self::OSS_ETAG])) {
         $options[self::OSS_HEADERS][self::OSS_IF_NONE_MATCH] = $options[self::OSS_ETAG];
         unset($options[self::OSS_ETAG]);
     }
     if (isset($options[self::OSS_RANGE])) {
         $range = $options[self::OSS_RANGE];
         $options[self::OSS_HEADERS][self::OSS_RANGE] = "bytes={$range}";
         unset($options[self::OSS_RANGE]);
     }
     $response = $this->auth($options);
     $result = new BodyResult($response);
     return $result->getData();
 }