Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yadhukrishnam committed May 18, 2021
1 parent 1337108 commit 162c6c0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,30 @@ describe('XML Body Parser', function () {
.expect(400, done);
});

it('should not set/change prototype', function (done) {
it('should not set/change prototype using __proto__', function (done) {
createServer();
request(app)
.post('/')
.set('Content-Type', 'application/xml')
.send('<__proto__><name>Bob</name></__proto__>')
.expect(200, { parsed: { name: ['Bob'] } }, done);
.expect(200, { parsed: {} }, done);
});

it('should not set/change using __proto__', function (done) {
createServer();
request(app)
.post('/')
.set('Content-Type', 'application/xml')
.send('<prototype><name>Bob</name></prototype>')
.expect(200, { parsed: {} }, done);
});

it('should not set/change using constructor', function (done) {
createServer();
request(app)
.post('/')
.set('Content-Type', 'application/xml')
.send('<constructor><name>Bob</name></constructor>')
.expect(200, { parsed: {} }, done);
});
});

0 comments on commit 162c6c0

Please sign in to comment.