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

Set base headers from environments #632

Closed
brenomeneghetti opened this issue Mar 11, 2019 · 2 comments
Closed

Set base headers from environments #632

brenomeneghetti opened this issue Mar 11, 2019 · 2 comments

Comments

@brenomeneghetti
Copy link

brenomeneghetti commented Mar 11, 2019

Is your feature request related to a problem? Please describe.
The headers of all my queries/mutations are the same most of the time and Altair keeps one set per tab which is kinda frustrating when you start to add your entire query/mutation list on it.

Describe the solution you'd like
It would be good to be able to define one set of headers per environment or even one set of headers for the entire app if the first is too hard. The better solution is to keep both options (the current version and the new one) available and be able to switch between these behaviors.

@imolorhe
Copy link
Collaborator

imolorhe commented Mar 12, 2019

The solution I see involves a combination of the environments with the headers. So if you want to have a set of headers for all your requests, you add the headers to the Global environments.

{
  "headers": {
    "X-my-common": "1234567890"
  }
}

Then Altair would include that as part of the headers while sending the requests.

The same rules for environment variables would apply. If you have headers set in a subenvironment, those would be combined with the headers in the Global environment. Obviously that would mean that the headers would need to be a simple key-value pair of primitives, any object would become [Object object].

@brenomeneghetti
Copy link
Author

I think this approach is better than setting the headers on every tab. It would be perfect if we could use the env variables to set the headers but it seems good enough as you proposed.

@imolorhe imolorhe changed the title Add option to use one set of headers per environment Set base headers from environments Mar 14, 2019
@imolorhe imolorhe added this to the v2.1.3 milestone Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants