Skip to content

Commit 34636be

Browse files
authored
test: Add test for saving file without extension (#9535)
1 parent 7194ccc commit 34636be

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/ParseFile.spec.js

+20
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,26 @@ describe('Parse.File testing', () => {
378378
expect(response.headers['content-type']).toMatch(/^text\/html/);
379379
});
380380

381+
it('works without Content-Type and extension', async () => {
382+
await reconfigureServer({
383+
fileUpload: {
384+
enableForPublic: true,
385+
},
386+
});
387+
const headers = {
388+
'X-Parse-Application-Id': 'test',
389+
'X-Parse-REST-API-Key': 'rest',
390+
};
391+
const result = await request({
392+
method: 'POST',
393+
headers: headers,
394+
url: 'http://localhost:8378/1/files/file',
395+
body: '<html></html>\n',
396+
});
397+
expect(result.data.url.includes('file.txt')).toBeTrue();
398+
expect(result.data.name.includes('file.txt')).toBeTrue();
399+
});
400+
381401
it('filename is url encoded', done => {
382402
const headers = {
383403
'Content-Type': 'text/html',

0 commit comments

Comments
 (0)