fix cors crash with malformed origin

This commit is contained in:
Girish Ramakrishnan
2016-07-07 16:42:08 -07:00
parent 5a6b5f945d
commit 3335936e35
2 changed files with 10 additions and 0 deletions

View File

@@ -235,6 +235,15 @@ describe('Server', function () {
});
});
it('does not crash for malformed origin', function (done) {
superagent('OPTIONS', SERVER_URL + '/api/v1/cloudron/status')
.set('Origin', 'foobar')
.end(function (error, res) {
expect(res.statusCode).to.be(405);
done();
});
});
after(function (done) {
server.stop(function () {
done();