Skip to content

Commit

Permalink
fix: compatible with content-type extra semicolon
Browse files Browse the repository at this point in the history
closes #5214
  • Loading branch information
fengmk2 committed Jun 19, 2023
1 parent 768affa commit eabec63
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/app/middleware/body_parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ describe('test/app/middleware/body_parser.test.js', () => {
.expect(200);
});

// fix https:/eggjs/egg/issues/5214
it.only('should 200 when post json with `content-type: application/json;charset=utf-8;`', () => {
app.mockCsrf();
return app.httpRequest()
.post('/test/body_parser/user')
.set('Cookie', cookies)
.set('Content-Type', 'application/json;charset=utf-8;')
.send({ test: 1 })
.expect({ test: 1 })
.expect(200);
});

it('should 200 when post json body below the limit', () => {
return app.httpRequest()
.post('/test/body_parser/user')
Expand Down

0 comments on commit eabec63

Please sign in to comment.