parent
edecb8c99f
commit
cf7e8df65f
2 changed files with 11 additions and 0 deletions
|
@ -33,6 +33,7 @@ impl<S> GraphQLRequest<S>
|
||||||
where
|
where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
{
|
{
|
||||||
|
/// Returns the `operation_name` associated with this request.
|
||||||
fn operation_name(&self) -> Option<&str> {
|
fn operation_name(&self) -> Option<&str> {
|
||||||
self.operation_name.as_ref().map(|oper_name| &**oper_name)
|
self.operation_name.as_ref().map(|oper_name| &**oper_name)
|
||||||
}
|
}
|
||||||
|
|
10
juniper/test/graph_ql_request.rs
Normal file
10
juniper/test/graph_ql_request.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
extern crate juniper;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pub_operation_name() {
|
||||||
|
use juniper::http::GraphQLRequest;
|
||||||
|
|
||||||
|
let request = GraphQLRequest::new("query".to_string(), Some("name".to_string()), None);
|
||||||
|
|
||||||
|
assert_eq!(request.operation_name(), Some("name"));
|
||||||
|
}
|
Loading…
Reference in a new issue