Created
December 1, 2015 07:19
-
-
Save nebulou5/b132e464b34fdccbdb5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('returns OPTIONS response if origin header is capitalized', (done) => { | |
const handler = function (request, reply) { | |
return reply(Boom.badRequest()); | |
}; | |
const server = new Hapi.Server(); | |
server.connection({ routes: { cors: true } }); | |
server.route({ method: 'GET', path: '/', handler: handler }); | |
server.inject({ method: 'OPTIONS', url: '/', headers: { Origin: 'http://example.com:8080/', 'access-control-request-method': 'GET' } }, (res) => { | |
expect(res.headers['access-control-allow-origin']).to.equal('http://example.com:8080/'); | |
done(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment