mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #4931] [MERGED] fix(relay): avoid override with header passthrough #4991
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#4991
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/4931
Author: @CuriousCorrelation
Created: 3/24/2025
Status: ✅ Merged
Merged: 3/25/2025
Merged by: @jamesgeorge007
Base:
next← Head:fix-relay-temp-avoid-content-type-override📝 Commits (1)
d8f4f63fix(relay): avoid override with header passthrough📊 Changes
6 files changed (+30 additions, -36 deletions)
View changed files
📝
packages/hoppscotch-agent/src-tauri/Cargo.lock(+2 -2)📝
packages/hoppscotch-desktop/plugin-workspace/relay/src/content.rs(+21 -19)📝
packages/hoppscotch-desktop/plugin-workspace/relay/src/header.rs(+0 -8)📝
packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lock(+1 -1)📝
packages/hoppscotch-desktop/src-tauri/Cargo.lock(+2 -2)📝
pnpm-lock.yaml(+4 -4)📄 Description
The prior implementation caused duplicate
Content-Typeheaders when users override headers in the UI or use OAuth2 authentication with the agent. Web servers receive multipleContent-Typeheaders which causes undefined behavior and 400 errors for backends that don't accept duplicate headers. This duplicate headers part has been fixed in https://github.com/hoppscotch/hoppscotch/pull/4911, this is a followup that fixes inconsistent behavior when overriding theContent-Typeheader with custom values (e.g.,application/json;v=2).Closes #4905
Closes HFE-790
This patch removes the automatic content-type header insertion, allowing user-defined headers to take precedence without duplication. The is a temporary workaround until we implement a HTTP/2-compliant solution with proper normalization.
This was implemented initially to support moving lower level handling towards the kernel, although since the larger refactor has been slightly deferred in favor of stability, this change is suitable for current state.
While HTTP/1.1 headers are case-insensitive per RFC 7230, inconsistent handling across server implementations can treat differently-cased variations (e.g., "Content-Type" vs "content-type") as distinct headers. HTTP/2 (RFC 7540) mandates converting all header field names to lowercase, which would prevent this issue.
This will be revisited when we implement HTTP/2 compliant header handling in the kernel layer as part of our upcoming kernel efforts.
Notes to reviewers
Use the following request to test this out on Desktop app and Agent and override
Content-Typeheader toapplication/json;=v2:Notice
Content-Type(sometimes) being set toapplication/jsoninstead ofapplication/json;v=2.The core issue is inconsistencies in the current version, see the following truncated server logs mentioned in https://github.com/hoppscotch/hoppscotch/issues/4905#issuecomment-2739623601 that describe how the
Content-Typeis received by the server, where override only works half of the time. With this fix, the override will always work.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
templatesdirectory in ARM images #5010