Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
requestContext: WithRequired<
GraphQLRequestContext,
'metrics' | 'queryHash'
>;
}): EndHandler {
this.treeBuilder.startTiming();
o.requestContext.metrics.startHrTime = this.treeBuilder.startHrTime;
// Generally, we'll get queryString here and not parsedQuery; we only get
// parsedQuery if you're using an OperationStore. In normal cases we'll get
// our documentAST in the execution callback after it is parsed.
const queryHash = o.requestContext.queryHash;
this.queryString = o.queryString;
this.documentAST = o.parsedQuery;
this.treeBuilder.trace.http = new Trace.HTTP({
method:
Trace.HTTP.Method[o.request.method as keyof typeof Trace.HTTP.Method] ||
Trace.HTTP.Method.UNKNOWN,
// Host and path are not used anywhere on the backend, so let's not bother
// trying to parse request.url to get them, which is a potential
// source of bugs because integrations have different behavior here.
// On Node's HTTP module, request.url only includes the path
// (see https://nodejs.org/api/http.html#http_message_url)
// The same is true on Lambda (where we pass event.path)
// But on environments like Cloudflare we do get a complete URL.
host: null,
path: null,
});
if (this.options.sendHeaders) {
makeHTTPRequestHeaders(