Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/cli-kit/src/api/partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {buildHeaders, debugLogRequest, handlingErrors} from './common.js'
import {ScriptServiceProxyQuery} from './graphql/index.js'
import {partners as partnersFqdn} from '../environment/fqdn.js'
import {graphqlClient} from '../http/graphql.js'
import {debug} from '../output.js'
import {Variables, RequestDocument} from 'graphql-request'

export async function request<T>(query: RequestDocument, token: string, variables?: Variables): Promise<T> {
Expand All @@ -12,7 +13,10 @@ export async function request<T>(query: RequestDocument, token: string, variable
const headers = await buildHeaders(token)
debugLogRequest(api, query, variables, headers)
const client = await graphqlClient({headers, url})
const t0 = performance.now()
const response = await client.request<T>(query, variables)
const t1 = performance.now()
debug(`Request to ${url.toString()} completed in ${Math.round(t1 - t0)} ms`)
return response
})
}
Expand Down
3 changes: 3 additions & 0 deletions packages/cli-kit/src/http/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export async function shopifyFetch(url: RequestInfo, init?: RequestInit): Respon
Sending ${options.method ?? 'GET'} request to URL ${url.toString()} and headers:
${sanitizedHeadersOutput((options?.headers ?? {}) as {[header: string]: string})}
`)
const t0 = performance.now()
const response = await nodeFetch(url, {...init, agent: await httpsAgent()})
const t1 = performance.now()
debug(`Request to ${url.toString()} completed with status ${response.status} in ${Math.round(t1 - t0)} ms`)
return response
}