Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Disable GET for non-query operations #18

Merged
merged 1 commit into from
Oct 1, 2015
Merged

Disable GET for non-query operations #18

merged 1 commit into from
Oct 1, 2015

Conversation

leebyron
Copy link
Contributor

This fixes #17 by disabling GET requests for non-query operations. However GraphiQL may still be presented for these GET queries, but the query will just not be immediately issued, allowing for exploration of mutations.

I considered adding an option flag to enable mutations on GET, but decided that this edge case is sufficiently rare that we should only introduce it when there is a clear and compelling use case so that we get the API correct.

* Helper function to produce an operation AST given a document and an
* operation name.
*/
function getOperation(documentAST: Object, operationName: ?string): ?Object {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this live in graphql-js somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same thought. I'll do that but give it some time to replace this usage to avoid bleeding-edge dependency-hell

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dschafer
Copy link
Contributor

This looks good, ship it.

This fixes #17 by disabling GET requests for non-query operations. However GraphiQL may still be presented for these GET queries, but the query will just not be immediately issued, allowing for exploration of mutations.

I considered adding an option flag to enable mutations on GET, but decided that this edge case is sufficiently rare that we should only introduce it when there is a clear and compelling use case so that we get the API correct.
leebyron added a commit that referenced this pull request Oct 1, 2015
Disable GET for non-query operations
@leebyron leebyron merged commit 53cd63f into master Oct 1, 2015
@leebyron leebyron deleted the safe-get branch October 1, 2015 02:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opt-in to accepting mutations on GET
3 participants