mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #3636] [MERGED] feat(cli): support collection level authorization and headers #4464
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#4464
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?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/3636
Author: @jamesgeorge007
Created: 12/8/2023
Status: ✅ Merged
Merged: 12/14/2023
Merged by: @AndrewBastin
Base:
release/2023.12.0← Head:feat/coll-root-auth-headers-cli📝 Commits (4)
ce51772feat: support collection level headers and authorization in CLI649e0d1fix: ensure child headers take precedence over parent headers1d697f0test: increase coverage32bb7f8chore: cleanup📊 Changes
5 files changed (+373 additions, -104 deletions)
View changed files
📝
packages/hoppscotch-cli/src/__tests__/commands/test.spec.ts(+52 -43)➕
packages/hoppscotch-cli/src/__tests__/samples/collection-level-headers-auth.json(+221 -0)📝
packages/hoppscotch-cli/src/__tests__/utils.ts(+11 -4)📝
packages/hoppscotch-cli/src/utils/collections.ts(+57 -41)📝
packages/hoppscotch-cli/src/utils/request.ts(+32 -16)📄 Description
Description
This PR includes the necessary changes to the CLI for processing the updated export format with authorization and headers set at the collection level.
authfields for folders/requests, the value at the current level is updated to be based on the immediate parent.headerfields, the value at the current level is extended based on the immediate parent. If there are header entries with keys under the same name, the value set at the child level takes precedence.Depends on #3505.
Closes HFE-295.
Steps to verify
Given below is a comprehensive sample to verify the behavior involving multiple auth types and headers. For a relatively simple example, please refer to the test suite.
Spin up an
Express.jsbased server as below. Initializepackage.jsonwithnpm init -yand addexpressas a dependency. Start the server withnode index.js. Optionally, add it as astartscript.Grab the following collection JSON contents and name it
collection.json.Navigate to the
hoppscotch-clipackage path, invoke the CLI supplying the above collection contents withRelevant tests are added to the above collection file under
testScriptto assert the expected results at each level. Observe all the tests pass ✅Checks
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.