mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #1741] [feature]: Collection-wide headers and authorization #551
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#551
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sawa-ko on GitHub (Jul 9, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1741
Is your feature request related to a problem? Please describe.
Yes, it is very annoying to be putting for example, the header of a Bearer Token in all requests and keep that header updated one by one.
Describe the solution you'd like
An option to assign to folders or collections of requests a set of global headers for the requests.
Describe alternatives you've considered
The current option is to do it one by one, something very annoying and exhausting.
Additional context
No.
@liyasthomas commented on GitHub (Jul 10, 2021):
This is a good feature request. Will look into implementing it.
@Shylajhaa commented on GitHub (Sep 30, 2021):
@liyasthomas Is this issue available to work on?
@liyasthomas commented on GitHub (Sep 30, 2021):
Hi @Shylajhaa, yes this issue is available for you to pick up. Thanks for showing interest in contributing to Hoppscotch, feel free to ping us if you got stuck.
@Shylajhaa commented on GitHub (Sep 30, 2021):
Thanks, @liyasthomas Can you assign it to me?
@Shylajhaa commented on GitHub (Oct 19, 2021):
Started working on this. Sharing my thoughts on design
When clicking on Edit collection, another input box to get auth should be added with the options as available already (None, Basic auth, ...)

In the auth tab of a request, Inherit auth from parent option should be added.

When sending a request, the auth info from parent collection will be used
@liyasthomas Let me know if I'm missing anything here.
@sawa-ko commented on GitHub (Oct 19, 2021):
But will that work only for the Authorization field of the Header or for everything in the Header?
@Shylajhaa commented on GitHub (Oct 20, 2021):
Only for the auth headers
@liyasthomas commented on GitHub (Oct 20, 2021):
I guess it shouldn't only be limited to auth headers alone. Instead, to minimize the user interaction in this feature I can suggest an alternative approach. Let me know if this suits the expected output.
Turning on the global toggle button on the section set all individual headers to have an "On" state and vice-versa.
Turning an individual entry's toggle button only sets its value to the global headers array.
Global headers array is always set for every request. This way user only needs to edit in the Header section to affect all requests that are being sent.
Here's a screenshot of how the UI might look with the proposed features. Note: this same approach can be applied to parameters, body, auth, tests and many more sections — by introducing a "Global" toggle button on sections and for individual entries as well.
Alternatively, Hoppscotch supports "Environments". The environment has "Global Environment" support. Set the volatile header value as an environment value (this can be done in any request sections: header, auth, parameters, body, etc.) and simply switch between environments to reflect the changes. Also updating the environment variable value can be done from the environments tab and the change is reflected globally.
Read more about Environments in documentation
@Shylajhaa commented on GitHub (Nov 27, 2021):
@liyasthomas Apologies for the delayed response. I will start looking into the design suggested by you and would like to work on this feature.
@Shylajhaa commented on GitHub (Dec 1, 2021):
@liyasthomas @kaname-png The environment approach will solve the problem, but only seems like a workaround. That might not be an ideal situation given that there could be several API endpoints grouped under individual folders with all of these folders sharing a common environment.
The Global-Local headers solution sounds like a suitable design. Can I start working on the same?
@liyasthomas commented on GitHub (Dec 1, 2021):
@AndrewBastin thoughts on this?
@AndrewBastin commented on GitHub (Dec 1, 2021):
I think storing metadata within collections regarding headers will work. During the Effective REST Request generation phase we just need to recursively traverse back the tree.
But this interestingly brings into the light some interesting side points we have to clear out.
Cascading – How the header fields cascade. (What happens when the headers are defined in multiple levels)
A UI representation – This increasingly obscures and makes it difficult to track the source of different header fields and actually the active header fields being applied onto a request and from where is a concern we have to not take lightly as this shoots up complexity on what has been a relatively easy to understand and use section of the app.
Disabling – We do offer options to disable header entries from a request, how are they going to be processed ?
Except point (2), rest all seem to be self explanatory. But these are meaningful points to be considered. The current implementation works and is simple and we are not trying to be another bloated complex API Request Builder so if we can communicate clearly what is happening and this is tucked away neatly unless explicitly required, we can go ahead with this.
@Shylajhaa commented on GitHub (Dec 3, 2021):
@liyasthomas @kaname-png Thoughts?
@sawa-ko commented on GitHub (Dec 3, 2021):
@Shylajhaa I like the idea of being able to store metadata in the request folders, for example: when viewing the folder options there should also be an option called headers and depending on what headers there are, they will be applied to the other requests within the collection folder, and that there is an option in the requests that is to ignore the use of global headers for that folder.
@Tommyten commented on GitHub (Feb 14, 2022):
@Shylajhaa Any news on this? This feature would be a great addition, I'm looking forward to
@AndyDonits commented on GitHub (Jul 25, 2022):
@Shylajhaa It would be great to have this feature, currently I need to edit 150 requests manually because when I imported the collection from postman it didn't take into account the authorization from the postman collection
@RenanDore commented on GitHub (Sep 29, 2022):
Hey devs, anyone have updates to this issue? Thanks!
@nfacha commented on GitHub (Jun 26, 2023):
+1 on this, this is by far the thing I miss most from Postman
@liyasthomas commented on GitHub (Dec 20, 2023):
Thanks for your patience and valuable feedback. This feature has been implemented in the latest release.
Closing this ticket as this feature is now available in the recent version. Feel free to reach out if you encounter any further concerns.
Documentation: https://docs.hoppscotch.io/documentation/features/collections#collection-properties