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