Registry / testing / graphql-got

graphql-got

JSON →
library0.1.2jsnpmunverified

Simple convenience wrapper for the got HTTP library to make GraphQL queries. Version 0.1.2, last updated in 2017. It is a lightweight alternative to Apollo Client and Relay, offering minimal API over got with support for query, variables, operationName, and bearer token authentication. No longer actively maintained; depends on got v7.x. Not suitable for production GraphQL clients compared to more modern alternatives.

npm install graphql-got
INSTALL
IMPORT
SIG · GRAPHQL-GOT
G
graphql-got
testingjavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (graphqlGot)
import graphqlGot from 'graphql-got'
import { graphqlGot } from 'graphql-got'
Default export; named import will fail.
default (require)
const graphqlGot = require('graphql-got')
const { graphqlGot } = require('graphql-got')
CommonJS usage via default require.
GraphqlGotOptions
// No TypeScript types provided; use JSDoc or any
import { GraphqlGotOptions } from 'graphql-got'
Package has no TypeScript declarations.

Shows basic usage: creating a GraphQL query with bearer token authentication and logging the response.

const graphqlGot = require('graphql-got'); const query = `{ unicorn(name: "Foo Bar") { id name } }`; graphqlGot('api.graphql.unicorn', { query, token: process.env.API_TOKEN || '' }).then(response => { console.log(response.body); }).catch(error => { console.error(error); });
Debug
Known issues
gotchaPackage uses got v7.x which is outdated. Got v8+ changed API incompatibly.
fix
Use a more recent library like graphql-request or apollo-upload-client.
affects: >=0.0.0
deprecatedgraphql-got is no longer maintained. Last release 2017.
fix
Switch to actively maintained GraphQL client libraries.
affects: >=0.0.0
gotchaURLs without protocol are automatically prepended with https://. This may break if endpoint uses http.
fix
Always include http:// or https:// in the URL.
affects: >=0.0.0
Errors
Common errors & fixes
Error: query must be a string
Missing or invalid 'query' option in the second argument.
fix
Provide a valid string query: graphqlGot(url, { query: '{ field }' })
TypeError: graphqlGot is not a function
Using named import instead of default import.
fix
Use default import: const graphqlGot = require('graphql-got')
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
gotrequiredCore HTTP library for making requests
Agent activity
6 hits · last 30 days
node
6
Resources
graphql-got — npm install graphql-got · libregistry