From 273aecb6bf229b3c62826836b4c4130fd487f4a6 Mon Sep 17 00:00:00 2001 From: sunli Date: Tue, 19 May 2020 00:03:15 +0800 Subject: [PATCH] Update schema.rs --- src/schema.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/schema.rs b/src/schema.rs index 003924d1..6e98b7aa 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -11,6 +11,7 @@ use crate::{ Environment, Error, ObjectType, Pos, QueryError, QueryResponse, Result, SubscriptionStream, SubscriptionType, Type, Variables, }; +use async_graphql_parser::query::OperationType; use bytes::Bytes; use futures::channel::mpsc; use futures::Stream; @@ -255,6 +256,10 @@ where }; } + if document.current_operation().ty != OperationType::Subscription { + return Err(QueryError::NotSupported.into_error(Pos::default())); + } + let resolve_id = AtomicUsize::default(); let environment = Arc::new(Environment { variables,