Skip to content

Commit 1addfdc

Browse files
kushal-93abernix
andauthored
improved error message to address issue #2941 (#2955)
improved error message for missing query string in GET request, to address issue #2941 Fixes #2941 Co-authored-by: Jesse Rosenberger <[email protected]>
1 parent f9ec392 commit 1addfdc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changesets/fix_dev-error-message.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Improved messaging when a request is received without an operation ([Issue #2941](https://github.com/apollographql/router/issues/2941))
2+
3+
The message that is displayed when a request has been sent to the Router without an operation has been improved. This materializes as a developer experience improvement since users (especially those using GraphqL for the first time) might send a request to the Router using a tool that isn't GraphQL-aware, or might just have their API tool of choice misconfigured.
4+
5+
Previously, the message stated "missing query string", but now more helpfully suggests sending either a POST or GET request and specifying the desired operation as the `query` parameter (i.e., either in the POST data or in the query string parameters for GET queries).
6+
7+
By [@kushal-93](https://github.com/kushal-93) in https://github.com/apollographql/router/pull/2955

apollo-router/src/services/router_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ where
196196
})
197197
})
198198
.unwrap_or_else(|| {
199-
Err(("missing query string", "missing query string".to_string()))
199+
Err(("There was no GraphQL operation to execute. Use the `query` parameter to send an operation, using either GET or POST.", "There was no GraphQL operation to execute. Use the `query` parameter to send an operation, using either GET or POST.".to_string()))
200200
})
201201
} else {
202202
hyper::body::to_bytes(body)

0 commit comments

Comments
 (0)