Skip to content

Commit b8fdecc

Browse files
authored
Set parse-server-test to 1.3.5 and mime type fix (#379)
* Upped parse-server-test to 1.3.5 * Fix for parse-server 2.7.0 unknown mime type response * HHVM note in readme while making notes * Not so bold * lint
1 parent fbbc83d commit b8fdecc

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Please note that this documentation contains the latest changes that may as of y
4747

4848
## Installation
4949
There are various ways to install and use this sdk. We'll elaborate on a couple here.
50-
Note that the Parse PHP SDK requires PHP 5.4 or newer.
50+
Note that the Parse PHP SDK requires PHP 5.4 or newer. It can also run on HHVM (recommended 3.0 or newer).
5151

5252
### Install with Composer
5353

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
"license": "SEE LICENSE IN LICENSE",
2121
"homepage": "https://github.com/montymxb/parse-server-test#readme",
2222
"dependencies": {
23-
"parse-server-test": "1.3.4"
23+
"parse-server-test": "1.3.5"
2424
}
2525
}

src/Parse/ParseFile.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ private function download()
252252
if ($httpStatus > 399) {
253253
throw new ParseException('Download failed, file may have been deleted.', $httpStatus);
254254
}
255-
$this->mimeType = $httpClient->getResponseContentType();
255+
$mimeType = $httpClient->getResponseContentType();
256+
if (isset($mimeType) && $mimeType !== 'null') {
257+
$this->mimeType = $mimeType;
258+
}
256259
$this->data = $response;
257260

258261
return $response;

tests/Parse/ParseFileTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ public function testParseFileTypes()
146146
$this->assertEquals($contents, $file3Again->getData());
147147

148148
// check mime types after calling getData
149-
$this->assertEquals('application/octet-stream', $fileAgain->getMimeType());
149+
$mt = $fileAgain->getMimeType();
150+
// both of the following are acceptable for a response from a submitted mime type of unknown/unknown
151+
$this->assertTrue(
152+
$mt === 'application/octet-stream' || // parse-server < 2.7.0
153+
$mt === 'unknown/unknown' // parse-server >= 2.7.0, unknown mime type response change
154+
);
150155
$this->assertEquals('image/png', $file2Again->getMimeType());
151156
$this->assertEquals('image/png', $file3Again->getMimeType());
152157
}

0 commit comments

Comments
 (0)