* Send query to GraphQL endpoint over http * * ```js * I.sendMutation(` * mutation createUser($user: UserInput!) { * createUser(user: $user) { * id * name * email * } * } * `, * { user: { *
(mutation, variables, options = {}, headers = {})
| 190 | * @return Promise<any> |
| 191 | */ |
| 192 | async sendMutation(mutation, variables, options = {}, headers = {}) { |
| 193 | if (typeof mutation !== 'string') { |
| 194 | throw new Error(`mutation expected to be a String, instead received ${typeof mutation}`) |
| 195 | } |
| 196 | const operation = { |
| 197 | query: mutation, |
| 198 | variables, |
| 199 | ...options, |
| 200 | } |
| 201 | const request = this._prepareGraphQLRequest(operation, headers) |
| 202 | return this._executeQuery(request) |
| 203 | } |
| 204 | |
| 205 | _setRequestTimeout(newTimeout) { |
| 206 | this.options.timeout = newTimeout |
no test coverage detected