Fixing #1900 JS SDK file upload (#1935)

* Fixing #1900 JS SDK file upload

JS SDK file upload uses req.body._ContentType to specify the upload content type

* Fixing import statements

* Dont clear the cache just delete the new entry that the test added.

* adding E2E test for _ContentType support
This commit is contained in:
Blayne Chard
2016-05-31 13:42:45 +12:00
committed by Florent Vilmart
parent cd525802a6
commit 3997b1aa5a
3 changed files with 96 additions and 0 deletions

View File

@@ -36,6 +36,31 @@ describe('Parse.File testing', () => {
});
});
it('works with _ContentType', done => {
request.post({
url: 'http://localhost:8378/1/files/file',
body: JSON.stringify({
_ApplicationId: 'test',
_JavaScriptKey: 'test',
_ContentType: 'text/html',
base64: 'PGh0bWw+PC9odG1sPgo='
})
}, (error, response, body) => {
expect(error).toBe(null);
var b = JSON.parse(body);
expect(b.name).toMatch(/_file.html/);
expect(b.url).toMatch(/^http:\/\/localhost:8378\/1\/files\/test\/.*file.html$/);
request.get(b.url, (error, response, body) => {
expect(response.headers['content-type']).toMatch('^text/html');
expect(error).toBe(null);
expect(body).toEqual('<html></html>\n');
done();
});
});
});
it('works without Content-Type', done => {
var headers = {
'X-Parse-Application-Id': 'test',