it('HTTP OPTIONS call to a right address with params with JS stubbed data', function(done) { supertest(app.app) .options('/saray/abc/call5?param1=value1') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
test('Test OPTIONS request', async (done) => { const RANDOM_ORIGIN = `https://${Math.random()}.random` const res = await request(app).options('/get').set('Origin', RANDOM_ORIGIN) expect(res.statusCode).toBe(200) // 'cause we accept requests from allOrigins :D expect(res.headers['access-control-allow-origin']).toBe(RANDOM_ORIGIN) expect(res.headers['access-control-allow-methods']).toBe('OPTIONS, GET, POST, PATCH, PUT, DELETE') expect(res.body.contents).toBeUndefined() done() })
it('should expose CORS headers in an OPTIONS request', async () => { const res = await request(service.requestHandler) .options('/token') .expect(204); expect(res.headers['access-control-allow-origin']).toBe('*'); });
it('(response-time not present) OPTIONS /users/info - 204', async () => { await request(gateway) .options('/users/info') .expect(204) .then((response) => { expect(response.header['x-response-time']).to.equal(undefined) }) })
it('HTTP OPTIONS call to a wrong address', function(done) { supertest(app.app) .options('/generic/options') .expect(404) .end(done); });
it('HTTP OPTIONS call to a right address with JSON stubbed data', function(done) { supertest(app.app) .options('/call') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
it('(cors present) OPTIONS /users/response-time/info - 204', async () => { await request(gateway) .options('/users/response-time/info') .expect(204) .then((response) => { expect(response.header['access-control-allow-origin']).to.equal('*') }) })
it('HTTP OPTIONS call to a right address with params with JS stubbed data', function(done) { supertest(app.app) .options('/call5?param1=value1') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
it('HTTP OPTIONS call to a right address with params 2 with JS stubbed data', function(done) { supertest(app.app) .options('/call6?param1=value1') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
it('(cors present) OPTIONS /users/info - 204', async () => { await request(gateway) .options('/users/info') .expect(204) .then((response) => { expect(response.header['access-control-allow-origin']).to.equal('*') }) })
it('HTTP OPTIONS call to a right address with params 2 with JS stubbed data', function(done) { supertest(app.app) .options('/saray/abc/call6?param1=value1') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
it('HTTP OPTIONS call to a right address with params with JSON stubbed data', function(done) { supertest(app.app) .options('/call2?param1=value1') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
it('HTTP OPTIONS call to a right address with params 2 with JSON stubbed data', function(done) { supertest(app.app) .options('/call3?param1=value1') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
it('HTTP OPTIONS call to a right address with JS stubbed data', function(done) { supertest(app.app) .options('/call4') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });
it('HTTP OPTIONS call to a right address with JS stubbed data', function(done) { supertest(app.app) .options('/saray/abc/call4') .expect(200) .end(function(err) { assert.ok(!err); return done(); }); });