New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphi

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphi - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

5

lib/index.js

@@ -58,3 +58,6 @@ 'use strict';

internals.graphqlHandler = async function (request, h) {
const source = request.method.toUpperCase() === 'GET' ? request.query : request.payload;
if (request.method.toUpperCase() === 'OPTIONS') {
return h.continue;
}
const source = request.method.toUpperCase() === 'GET' ? request.query : (request.payload || {});

@@ -61,0 +64,0 @@ const operationName = source.operationName;

2

package.json
{
"name": "graphi",
"version": "5.0.0",
"version": "5.0.1",
"description": "hapi graphql plugin",

@@ -5,0 +5,0 @@ "main": "lib",

@@ -535,2 +535,62 @@ 'use strict';

});
it('will handle graphql POST request without a payload', async () => {
const schema = `
type Person {
firstname: String!
lastname: String!
email: String!
}
type Query {
person(firstname: String!): Person!
}
`;
const getPerson = function (args, request) {
expect(args.firstname).to.equal('billy');
expect(request.path).to.equal('/graphql');
return { firstname: '', lastname: 'jean', email: 'what' };
};
const resolvers = {
person: getPerson
};
const server = Hapi.server();
await server.register({ plugin: Graphi, options: { schema, resolvers } });
const res = await server.inject({ method: 'POST', url: '/graphql' });
expect(res.statusCode).to.equal(400);
});
it('will handle graphql OPTIONS request when cors is disabled', async () => {
const schema = `
type Person {
firstname: String!
lastname: String!
email: String!
}
type Query {
person(firstname: String!): Person!
}
`;
const getPerson = function (args, request) {
expect(args.firstname).to.equal('billy');
expect(request.path).to.equal('/graphql');
return { firstname: '', lastname: 'jean', email: 'what' };
};
const resolvers = {
person: getPerson
};
const server = Hapi.server();
await server.register({ plugin: Graphi, options: { schema, resolvers } });
const res = await server.inject({ method: 'OPTIONS', url: '/graphql' });
expect(res.statusCode).to.equal(200);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc