From 333f5d1e233b66e408f1b6ff9f8690a34946eb40 Mon Sep 17 00:00:00 2001 From: Jonas Helfer Date: Fri, 29 Jul 2016 12:47:27 -0700 Subject: [PATCH] test that only POST requests are allowed --- src/integrations/integrations.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/integrations/integrations.test.ts b/src/integrations/integrations.test.ts index 9c5fd7d1..f7e18cd9 100644 --- a/src/integrations/integrations.test.ts +++ b/src/integrations/integrations.test.ts @@ -154,6 +154,18 @@ export default (createApp: CreateAppFunc, destroyApp?: DestroyAppFunc) => { }); }); + it('rejects the request if the method is not POST', () => { + app = createApp({excludeParser: true}); + const req = request(app) + .get('/graphql') + .send(); + return req.then((res) => { + expect(res.status).to.be.oneOf([404, 405]); + // HAPI doesn't return allow header, so we can't test this. + // return expect(res.headers['allow']).to.equal('POST'); + }); + }); + it('throws an error if POST body is missing', () => { app = createApp({excludeParser: true}); const req = request(app)