Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run pre-request scripts when auto-fetching GraphQL schema #10957

Open
1 task done
ruben-treams opened this issue May 30, 2022 · 9 comments
Open
1 task done

Run pre-request scripts when auto-fetching GraphQL schema #10957

ruben-treams opened this issue May 30, 2022 · 9 comments
Labels
feature product/runtime protocol/graphql Issues relating to the GraphQL protocol within Postman sandbox

Comments

@ruben-treams
Copy link

Is there an existing request for this feature?

  • I have searched the existing issues for this feature request and I know that duplicates will be closed

Is your feature request related to a problem?

Our API requires an extra header to be sent with all requests when an auth-header is sent. When an auth-header is set in the Postman collection, we also need to send that additional header.

All requests in the collection run the same pre-request scripts defined on the collection, but this code isn't executed when auto-fetch is used.

Describe the solution you'd like

Run pre-request scripts when Auto fetch is used.

Describe alternatives you've considered

No response

Additional context

No response

@giridharvc7 giridharvc7 added product/runtime sandbox protocol/graphql Issues relating to the GraphQL protocol within Postman labels Jun 1, 2022
@gnawf
Copy link

gnawf commented Nov 21, 2022

Tried to switch to Postman but this was a deal breaker. My team makes heavy use of GraphQL.

Pre-request scripts are great and we need it for auth, otherwise config is duplicated everywhere (and so, Postman is now no better than our current client).

As things stand, the GraphQL query editor is basically a plaintext editor. No schema and thus autocomplete is a huge blocker.

@ruben-treams
Copy link
Author

Is there any chance this could be taken into consideration?

@willemdupreez
Copy link

Any movement on this? We are actively considering alternatives to Postman for the same reasons as @gnawf.

@giridharvc7
Copy link

GraphQL in postman now supports introspection. Can you help us understand your workflow where you want to run a script pre-introspection?

@ab-tools
Copy link

The point is that auto-fetching the GraphQL scheme is not working for us:
image

The reason is that the complete GraphQL endpoint is behind an authentication which is performed by a pre-request script (and corresponding headers set) before a query is sent to the server.

Unfortunately, Postman scheme auto-fetching is ignoring the pre-script and query headers and just tries to access the GraphQL endpoint without authentication which obviously fails.

But I do recognize though that it is possible in the meantime to manually create an API with a GraphQL scheme in Postman and also manually select this API schema in the request GraphQL view accordingly.

While it would still be preferred if Postman would just be able to auto-fetch an API scheme (by simply using the same pre-script and headers already defined in the request itself), specifying the GraphQL scheme manually is a work-around at least. The downside is that you always need to remember to manually update the API scheme in Postman whenever the API changes. So if it could be implemented that auto-fetching works also with pre-scripts that would still be best in my opinion.

Thanks for the follow-up, by the way.

@dawid-dahl-umain
Copy link

This also makes it unusable for me. I get a token in a pre-request script, so now introspection doesn't work. (When I get the token and hard-code it in the Authorization header it works, but the tokens are short-lived and I don't want to get new one's manually.)

@moinologics
Copy link

waiting for this issue to resolved

@esdrasbeleza
Copy link

This also makes it unusable for me. I get a token in a pre-request script, so now introspection doesn't work. (When I get the token and hard-code it in the Authorization header it works, but the tokens are short-lived and I don't want to get new one's manually.)

Same thing here. It would be able to use the pre-request script to set other headers too.

@slaphead
Copy link

slaphead commented May 6, 2024

Any idea when this might be implemented please? The ability to set an authentication token via pre-request script for introspection is, I would imagine, a standard requirement if this application is going to support graphql.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature product/runtime protocol/graphql Issues relating to the GraphQL protocol within Postman sandbox
Projects
None yet
Development

No branches or pull requests

9 participants