Skip to content

Enable bypassing persisted operations #2

Open
@benjie

Description

Feature description

Add a function, like allowExplain, that governs whether a request may use arbitrary operations versus only persisted operations.

Motivating example

In development it's common to want to send arbitrary queries from GraphiQL whilst also enforcing Persisted Operations from the application.

app.use(postgraphile(DATABASE_URL, SCHEMAS, {
  allowUnpersistedOperation(req) {
    return process.env.NODE_ENV === "development" && req.headers.referer.endsWith("/graphiql");
  }
});

(Should we pass the operation too, I wonder?)

Breaking changes

None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions