File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
graphene_django/static/graphene_django Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 135
135
// Run a regex against the query to determine the operation type (query, mutation, subscription).
136
136
var operationRegex = new RegExp (
137
137
// Look for lines that start with an operation keyword, ignoring whitespace.
138
- "^\\s*(query|mutation|subscription)\\s+ " +
139
- // The operation keyword should be followed by the operationName in the GraphQL parameters.
140
- graphQLParams . operationName +
138
+ "^\\s*(query|mutation|subscription)\\s* " +
139
+ // The operation keyword should be followed by whitespace and the operationName in the GraphQL parameters (if available) .
140
+ ( graphQLParams . operationName ? ( "\\s+" + graphQLParams . operationName ) : "" ) +
141
141
// The line should eventually encounter an opening curly brace.
142
142
"[^\\{]*\\{" ,
143
143
// Enable multiline matching.
144
144
"m" ,
145
145
) ;
146
146
var match = operationRegex . exec ( graphQLParams . query ) ;
147
+ if ( ! match ) {
148
+ return "query" ;
149
+ }
147
150
148
151
return match [ 1 ] ;
149
152
}
You can’t perform that action at this time.
0 commit comments