Skip to content

Commit

Permalink
introspection query
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed May 29, 2019
1 parent 8295ebd commit 7a05ea9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DEFAULT = {
}

function Gest(schema, config) {
const { baseURL, headers, timeout, globals, verbose } = Object.assign(DEFAULT, config) // default config
const { baseURL, headers, timeout, globals, verbose } = Object.assign({}, DEFAULT, config) // default config

const instance = axios.create({
timeout,
Expand All @@ -30,7 +30,12 @@ function Gest(schema, config) {
return instance
.post(corrected, encode(query))
.then(res => res.data)
.catch(e => e.response.data)
.catch(e => {
if (e.response) {
return e.response.data
}
return e
})
}

if (verbose) console.log(query)
Expand Down

0 comments on commit 7a05ea9

Please sign in to comment.