mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00
test that only POST requests are allowed
This commit is contained in:
parent
5faab1958b
commit
333f5d1e23
1 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue