Update schema.rs

This commit is contained in:
sunli 2020-05-19 00:03:15 +08:00
parent f04a2291f9
commit 273aecb6bf

View File

@ -11,6 +11,7 @@ use crate::{
Environment, Error, ObjectType, Pos, QueryError, QueryResponse, Result, SubscriptionStream, Environment, Error, ObjectType, Pos, QueryError, QueryResponse, Result, SubscriptionStream,
SubscriptionType, Type, Variables, SubscriptionType, Type, Variables,
}; };
use async_graphql_parser::query::OperationType;
use bytes::Bytes; use bytes::Bytes;
use futures::channel::mpsc; use futures::channel::mpsc;
use futures::Stream; 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 resolve_id = AtomicUsize::default();
let environment = Arc::new(Environment { let environment = Arc::new(Environment {
variables, variables,