MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / sendQuery

Method sendQuery

lib/helper/GraphQL.js:152–163  ·  view source on GitHub ↗

* Send query to GraphQL endpoint over http. * Returns a response as a promise. * * ```js * * const response = await I.sendQuery('{ users { name email }}'); * // with variables * const response = await I.sendQuery( * 'query getUser($id: ID) { user(id: $id) { name email }}',

(query, variables, options = {}, headers = {})

Source from the content-addressed store, hash-verified

150 * @return Promise<any>
151 */
152 async sendQuery(query, variables, options = {}, headers = {}) {
153 if (typeof query !== 'string') {
154 throw new Error(`query expected to be a String, instead received ${typeof query}`)
155 }
156 const operation = {
157 query,
158 variables,
159 ...options,
160 }
161 const request = this._prepareGraphQLRequest(operation, headers)
162 return this._executeQuery(request)
163 }
164
165 /**
166 * Send query to GraphQL endpoint over http

Callers 2

GraphQL_test.jsFile · 0.80

Calls 2

_executeQueryMethod · 0.95

Tested by

no test coverage detected