Add 'unnamed' for the operations without the name.

This commit is contained in:
2023-10-07 14:35:31 +01:00
parent 8673f1caf8
commit f9e917f2ea
+5 -1
View File
@@ -34,7 +34,11 @@ func parseGraphQLQuery(c *fiber.Ctx) (operationType, operationName string, cache
for _, d := range p.Definitions {
if oper, ok := d.(*ast.OperationDefinition); ok {
operationType = oper.Operation
operationName = oper.Name.Value
if oper.Name != nil {
operationName = oper.Name.Value
} else {
operationName = "undefined"
}
for _, dir := range oper.Directives {
if dir.Name.Value == "cached" {
cacheRequest = true