mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-12 09:12:18 +03:00
Remove operation name from the regex and default to query
This commit is contained in:
parent
e439bf3727
commit
587af8f608
|
@ -136,14 +136,15 @@
|
||||||
var operationRegex = new RegExp(
|
var operationRegex = new RegExp(
|
||||||
// Look for lines that start with an operation keyword, ignoring whitespace.
|
// Look for lines that start with an operation keyword, ignoring whitespace.
|
||||||
"^\\s*(query|mutation|subscription)\\s+" +
|
"^\\s*(query|mutation|subscription)\\s+" +
|
||||||
// The operation keyword should be followed by the operationName in the GraphQL parameters.
|
|
||||||
graphQLParams.operationName +
|
|
||||||
// The line should eventually encounter an opening curly brace.
|
// The line should eventually encounter an opening curly brace.
|
||||||
"[^\\{]*\\{",
|
"[^\\{]*\\{",
|
||||||
// Enable multiline matching.
|
// Enable multiline matching.
|
||||||
"m",
|
"m",
|
||||||
);
|
);
|
||||||
var match = operationRegex.exec(graphQLParams.query);
|
var match = operationRegex.exec(graphQLParams.query);
|
||||||
|
if (!match) {
|
||||||
|
return "query";
|
||||||
|
}
|
||||||
|
|
||||||
return match[1];
|
return match[1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user