Merge pull request #6317 from overleaf/jpa-send-explicit-content-type

[web] send explicit content type in responses

GitOrigin-RevId: d5aeaba57a7d2fc053fbf5adc2299fb46e435341
This commit is contained in:
Jakob Ackermann
2022-01-18 09:03:18 +00:00
committed by Copybot
parent c97e95aeba
commit d720d6affa
43 changed files with 390 additions and 224 deletions
@@ -100,10 +100,12 @@ describe('ProjectUploadController', function () {
})
it('should return a successful response to the FileUploader client', function () {
return expect(this.res.body).to.deep.equal({
success: true,
project_id: this.project_id,
})
return expect(this.res.body).to.deep.equal(
JSON.stringify({
success: true,
project_id: this.project_id,
})
)
})
it('should record the time taken to do the upload', function () {
@@ -200,11 +202,13 @@ describe('ProjectUploadController', function () {
})
it('should return a successful response to the FileUploader client', function () {
return expect(this.res.body).to.deep.equal({
success: true,
entity_id: this.entity._id,
entity_type: 'file',
})
return expect(this.res.body).to.deep.equal(
JSON.stringify({
success: true,
entity_id: this.entity._id,
entity_type: 'file',
})
)
})
it('should time the request', function () {
@@ -225,9 +229,11 @@ describe('ProjectUploadController', function () {
})
it('should return an unsuccessful response to the FileUploader client', function () {
return expect(this.res.body).to.deep.equal({
success: false,
})
return expect(this.res.body).to.deep.equal(
JSON.stringify({
success: false,
})
)
})
})
@@ -240,10 +246,12 @@ describe('ProjectUploadController', function () {
})
it('should return an unsuccessful response to the FileUploader client', function () {
return expect(this.res.body).to.deep.equal({
success: false,
error: 'project_has_too_many_files',
})
return expect(this.res.body).to.deep.equal(
JSON.stringify({
success: false,
error: 'project_has_too_many_files',
})
)
})
})
@@ -254,10 +262,12 @@ describe('ProjectUploadController', function () {
})
it('should return a a non success response', function () {
return expect(this.res.body).to.deep.equal({
success: false,
error: 'invalid_filename',
})
return expect(this.res.body).to.deep.equal(
JSON.stringify({
success: false,
error: 'invalid_filename',
})
)
})
})
})