branch: elpa/graphql-mode
commit c643d53a4b1bfa654c361c22caea6964c5334a4e
Author: Artur Malabarba <[email protected]>
Commit: Artur Malabarba <[email protected]>
Don't send operationName when operation is an empty string
This happen, for instance, in the query below. That would cause
"operationName": "" to be sent in the request json, which leads to
errors in the backend.
query {
repositoryOwner(login: "Malabarba") {
repositories(first: 100, isFork: false) {
totalCount
nodes { name }
}
}
}
---
graphql-mode.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/graphql-mode.el b/graphql-mode.el
index c61768903e..0b5cea5e78 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -77,7 +77,7 @@
"Put together a json like object with QUERY, OPERATION, and VARIABLES."
(let* ((body '()))
(push (cons 'query query) body)
- (when operation
+ (when (and operation (not (string= operation "")))
(push (cons 'operationName operation) body))
(when variables
(push (cons 'variables variables) body))