mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #4242] [MERGED] fix: ensure Content-Type header priority in the CLI #4721
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#4721
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/4242
Author: @jamesgeorge007
Created: 8/6/2024
Status: ✅ Merged
Merged: 8/7/2024
Merged by: @jamesgeorge007
Base:
patch← Head:fix/cli-content-type-header-priority📝 Commits (1)
d1f88e4fix: ensureContent-Typeheader priority in the CLI📊 Changes
11 files changed (+290 additions, -32 deletions)
View changed files
📝
packages/hoppscotch-cli/package.json(+1 -1)📝
packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts(+10 -0)➕
packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/content-type-header-scenarios.json(+171 -0)📝
packages/hoppscotch-cli/src/__tests__/unit/fixtures/workspace-access.mock.ts(+3 -3)📝
packages/hoppscotch-cli/src/utils/pre-request.ts(+8 -2)📝
packages/hoppscotch-cli/src/utils/request.ts(+17 -9)📝
packages/hoppscotch-common/src/helpers/utils/contenttypes.ts(+2 -0)📝
packages/hoppscotch-common/src/services/persistence/__tests__/__mocks__/index.ts(+8 -4)📝
packages/hoppscotch-data/src/rest/content-types.ts(+4 -1)📝
packages/hoppscotch-data/src/rest/index.ts(+17 -12)➕
packages/hoppscotch-data/src/rest/v/6.ts(+49 -0)📄 Description
Description
The
Content-Typeheader set takes priority over the value set at the request body in the app. However, this wasn't the behaviour in the CLI the respective header was set to the value specified in the request body. This PR aims to resolve this behaviour and ensure consistency between the app and the CLI.Additionally,
text/xmlis added to the list of supported content types. It's now available to choose from the list of content types under the request body from the UI. The CLI will now recognise a collection export with aPOSTrequest having a content type set to the same.Closes HFE-555, #4220 #4101
What's changed
Content-Headerheader entry based on the content type set at the request body always and instead perform it conditionally accounting for a pre-existing header.Content-Typeheader entries.v0.10.2.text/xmlto the list of supported content types. It is added under theTextcategory similar toapplication/xmlsince it is focused more on structured data and used in data processing.HoppRESTRequestschemav6withtext/xmladded under the supported content types.HoppRESTReqBodyis exported from thev6schema instead of thev1variant.Note to reviewers
The collection added under e2e test fixtures can be used to test against while verifying the behaviour.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.