@@ -3,6 +3,7 @@ import {addCursorAndFiltersToAppLogsUrl} from './utilities.js'
33import { appManagementFqdn } from '../context/fqdn.js'
44import { setNextDeprecationDate } from '../../../private/node/context/deprecations-store.js'
55import { buildHeaders } from '../../../private/node/api/headers.js'
6+ import { getEnvironmentVariables } from '../environment.js'
67import { RequestModeInput } from '../http.js'
78import Bottleneck from 'bottleneck'
89import { TypedDocumentNode } from '@graphql-typed-document-node/core'
@@ -20,16 +21,32 @@ async function setupRequest(token: string) {
2021 const api = 'App Management'
2122 const fqdn = await appManagementFqdn ( )
2223 const url = `https://${ fqdn } /app_management/unstable/graphql.json`
24+
25+ const addedHeaders : { [ key : string ] : string } = { }
26+
27+ // Add canary header if CANARY environment variable is set to '1'
28+ if ( getEnvironmentVariables ( ) [ 'CANARY' ] === '1' ) {
29+ addedHeaders [ 'Shopify-Force-Canary' ] = 'unstable'
30+ }
31+
2332 return {
2433 token,
2534 api,
2635 url,
36+ addedHeaders,
2737 responseOptions : { onResponse : handleDeprecations } ,
2838 }
2939}
3040
3141export const appManagementHeaders = ( token : string ) : { [ key : string ] : string } => {
32- return buildHeaders ( token )
42+ const headers = buildHeaders ( token )
43+
44+ // Add canary header if CANARY environment variable is set to '1'
45+ if ( getEnvironmentVariables ( ) [ 'CANARY' ] === '1' ) {
46+ headers [ 'Shopify-Force-Canary' ] = 'unstable'
47+ }
48+
49+ return headers
3350}
3451
3552export const appManagementAppLogsUrl = async (
0 commit comments