Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-http

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-http - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

24

lib/__tests__/index.js
'use strict';
var url = require('url');
var fetchMock = require('fetch-mock');

@@ -66,2 +67,25 @@

});
pit('should work with onlyBody mutate', function () {
fetchMock.post('*', {
body: {data: {whatwhat: true}},
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
});
var client = GQL.GQLClient('https://example.com/gql');
return client.configure({onlyBody: true})
.mutate('mutation foo{bar(){baz}}')
.then(function (result) {
expect(result).toEqual({
data: {whatwhat: true}
});
var request = fetchMock.lastCall();
expect(url.parse(request[0]).search).toBe(null);
});
});
});

6

lib/index.js

@@ -44,3 +44,7 @@ 'use strict';

var requestUrl = this.url + '?' + params;
var requestUrl = this.options.onlyBody ? (
this.url
) : (
this.url + '?' + params
);

@@ -47,0 +51,0 @@ var method = this.options.method.toLowerCase();

2

package.json
{
"name": "graphql-http",
"version": "0.1.1",
"version": "0.2.0",
"description": "A GraphQL client for executing GraphQL queries over HTTP.",

@@ -5,0 +5,0 @@ "scripts": {

@@ -5,3 +5,8 @@ # graphql-http

### DISCLAIMER
This library is not suitable for production use. If you're looking for a client
with similar functionality, see [Lokka](https://github.com/kadirahq/lokka). It
has much more support and is much more robust.
### Usage

@@ -13,7 +18,9 @@

const client = GQLClient('http://localhost:3000', {
// anything passed here is merged with
// the options passed to fetch()
credentials: true,
headers: {
'X-Requested-With': 'XMLHttpRequest'
fetch: {
// anything passed here is merged with
// the options passed to fetch()
credentials: true,
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
}

@@ -20,0 +27,0 @@ });

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