graphql-client
Advanced tools
Comparing version 1.1.0 to 2.0.0
10
index.js
@@ -34,10 +34,2 @@ function highlightQuery (query, errors) { | ||
function GraphqlError(query, errors) { | ||
var e = new Error(errors.map(function (e) { return e.message }).join('\n') + '\n' + highlightQuery(query, errors)) | ||
e.originalErrors = errors | ||
return e | ||
} | ||
module.exports = function (params) { | ||
@@ -70,3 +62,3 @@ require('isomorphic-fetch') | ||
if (body.errors && body.errors.length) { | ||
throw new GraphqlError(query, body.errors) | ||
body.highlightQuery = highlightQuery(query, body.errors) | ||
} | ||
@@ -73,0 +65,0 @@ |
{ | ||
"name": "graphql-client", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -17,4 +17,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"isomorphic-fetch": "2.2.1" | ||
"isomorphic-fetch": "^2.2.1" | ||
} | ||
} |
@@ -19,3 +19,3 @@ # Simple GraphQL Client | ||
headers: { | ||
Authentication: 'Bearer ' + token | ||
Authorization: 'Bearer ' + token | ||
} | ||
@@ -30,3 +30,9 @@ }) | ||
```javascript | ||
var query = ` | ||
var variables = { | ||
query: "Search Query", | ||
limit: 100, | ||
from: 200 | ||
} | ||
client.query(` | ||
query search ($query: String, $from: Int, $limit: Int) { | ||
@@ -40,13 +46,5 @@ search(query: $query, from: $from, limit: $limit) { | ||
} | ||
}` | ||
var variables = { | ||
query: "Search Query", | ||
limit: 100, | ||
from: 200 | ||
} | ||
client.query(query, variables, function optionalCallback(req, res) { | ||
if(res.headers.get('x-powered-by') === 'Express') { | ||
throw new Error("Don't want conten served from express") | ||
}`, variables, function(req, res) { | ||
if(res.status === 401) { | ||
throw new Error('Not authorized') | ||
} | ||
@@ -53,0 +51,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3170
54
56
Updatedisomorphic-fetch@^2.2.1