Temporarily support graphql-client-vesion header (#139)

Our CLI sent a header with a typo.
We'll support both for next 30 days or more to collect correct versions.
After that, we will drop the header and use SchemaPublishMissingServiceError in schemaPublish mutation by default.
This commit is contained in:
Kamil Kisiela 2022-06-14 10:42:29 +02:00 committed by GitHub
parent 24f7d9bf61
commit 2aca3b8e2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,7 +117,14 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth
endpoint: process.env.HIVE_USAGE_ENDPOINT,
clientInfo(ctx: { req: FastifyRequest; reply: FastifyReply }) {
const name = ctx.req.headers['graphql-client-name'] as string;
const version = (ctx.req.headers['graphql-client-version'] as string) ?? 'missing';
const version =
((ctx.req.headers['graphql-client-version'] as string) ||
// Our CLI sent a header with a typo.
// We'll support both for next 30 days or more to collect correct versions.
// After that, we will drop the header
// and use SchemaPublishMissingServiceError in schemaPublish mutation by default.
(ctx.req.headers['graphql-client-vesion'] as string)) ??
'missing';
if (name) {
return { name, version };