@@ -70,35 +70,35 @@ export class NetworkHelper {
70
70
headers : endpoint . headers as HeadersInit ,
71
71
// this is an option that's only available in `node-fetch`, not in the standard fetch API
72
72
// @ts -expect-error
73
- agent,
73
+ agent : new URL ( endpoint . url ) . protocol === 'https:' ? agent : undefined ,
74
74
} ,
75
75
exchanges,
76
76
} )
77
77
}
78
78
79
79
buildSubscribeConsumer =
80
80
( cb : ExecuteOperationOptions [ "updateCallback" ] , operation : string ) =>
81
- ( result : OperationResult ) => {
82
- const { errors, data, error } = result as {
83
- error ?: CombinedError
84
- errors ?: GraphQLError [ ]
85
- data ?: unknown
86
- }
87
- if ( errors || data ) {
88
- cb ( formatData ( result ) , operation )
89
- }
90
- if ( error ) {
91
- if ( error . graphQLErrors && error . graphQLErrors . length > 0 ) {
92
- cb (
93
- JSON . stringify ( { errors : error . graphQLErrors } , null , 2 ) ,
94
- operation ,
95
- )
81
+ ( result : OperationResult ) => {
82
+ const { errors, data, error } = result as {
83
+ error ?: CombinedError
84
+ errors ?: GraphQLError [ ]
85
+ data ?: unknown
86
+ }
87
+ if ( errors || data ) {
88
+ cb ( formatData ( result ) , operation )
96
89
}
97
- if ( error . networkError ) {
98
- cb ( error . networkError . toString ( ) , operation )
90
+ if ( error ) {
91
+ if ( error . graphQLErrors && error . graphQLErrors . length > 0 ) {
92
+ cb (
93
+ JSON . stringify ( { errors : error . graphQLErrors } , null , 2 ) ,
94
+ operation ,
95
+ )
96
+ }
97
+ if ( error . networkError ) {
98
+ cb ( error . networkError . toString ( ) , operation )
99
+ }
99
100
}
100
101
}
101
- }
102
102
103
103
async executeOperation ( {
104
104
endpoint,
0 commit comments