Add graphql-client-* headers to GraphQL calls in client (#2984)

This commit is contained in:
Kamil Kisiela 2023-09-29 13:47:49 +02:00 committed by GitHub
parent 0c14917f63
commit c5a9946da3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -98,6 +98,8 @@ export function createHive(options: HivePluginOptions): HiveClient {
'content-type': 'application/json',
Authorization: `Bearer ${options.token}`,
'user-agent': `hive-client/${version}`,
'graphql-client-name': 'Hive Client',
'graphql-client-version': version,
},
timeout: 30_000,
decompress: true,

View file

@ -1,6 +1,7 @@
import axios from 'axios';
import type { DocumentNode } from 'graphql';
import { parse, stripIgnoredCharacters } from 'graphql';
import { version } from '../version.js';
import type { HivePluginOptions } from './types.js';
export interface OperationsStore {
@ -52,6 +53,8 @@ export function createOperationsStore(pluginOptions: HivePluginOptions): Operati
headers: {
'content-type': 'application/json',
Authorization: `Bearer ${token}`,
'graphql-client-name': 'Hive Client',
'graphql-client-version': version,
},
},
);