AnvarNazar / insomnia-plugin-global-headers

Other
14 stars 1 forks source link

Global headers in multiple collections/projects #3

Open dennismi opened 9 months ago

dennismi commented 9 months ago

Hi

First off, thanks for a very useful plugin :) Unfortunately I have hit an corner case.

I have multiple collections/projects, each with its own authentication flow (OAuth)

It seems that the headers will get transfered between collections/projects regardless of what I am doing.

Any ideas how to get around this issue? or can you fix this handy plugin?

AnvarNazar commented 8 months ago

I was not following Insomnia for some time now. However I installed Insomnia and the plugin now after seeing your Issue. It seems there is no major API changes and the plugin is working fine with multiple collections. The environment from one collection is not being transferred to another collection so the global headers are also not being transferred between collections. Please double check your base environment in each collection.

I suspect you are referring to the folders as "collections"? If that is the case,

You can disable/enable this plugin folder wide using these options below image Or you can use environment overrides from a collections options and override the global headers values you want just for that selected folder or request. image

Another way is to use sub environments to quickly switch between environments and that will also switch between global headers defined inside those sub environments.

If you are sure the global headers are being transferred between "Insomnia Collections" regardless of the environment you are using in each collection, let me know because that would be a bug..

dennismi commented 7 months ago

first off sorry for the late response

I have been trying different things, and I seem to have located where it goes wrong.

If you put the global header in the "base environment" in two different projects image

When a request, requests a header it seems to read the wrong "base environment", and then it will get an wrong token back.

everything else works with the base environment, that is I cannot use variables from the other "base environment", it seems to be only when your plugin is in use.

A more structured description (I hope)

2 Projects

That should suffice to get something working. Need two different authentication services.

dennismi commented 7 months ago

just an additional addition, if I only put the global headers section in the sub environments it only works on the first. other sub-environments reverts back to the other global headers section in the base environment of the other project.