api-client/packages
Shreyas 72ff950d91
fix(relay): avoid override with header passthrough (#4931)
The current implementation causes duplicate `Content-Type` headers when users
override headers in the UI or use OAuth2 authentication with the agent.
Web servers receive multiple `Content-Type` headers which causes
undefined behavior and 400 errors for backends that don't accept duplicate headers.

This also fixes inconsistent behavior when overriding the `Content-Type` header
with custom values (e.g., `application/json;v=2`).

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 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.

This will be revisited when we implement HTTP/2 compliant header handling in the
kernel layer as part of our upcoming kernel efforts.

Use the following request to test this out on Desktop app and Agent and
override `Content-Type` header to `application/json;=v2`:

```
curl --request POST \
  --url 'https://echo.qubit.codes/?qp=1' \
  --header 'Content-Type: application/json;v=2' \
  --data '{ "test-key": "test-value" }'
```
2025-03-25 16:34:27 +05:30
..
codemirror-lang-graphql feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
hoppscotch-agent fix(relay): avoid override with header passthrough (#4931) 2025-03-25 16:34:27 +05:30
hoppscotch-backend chore: bump version to 2025.2.3 2025-03-19 14:41:08 +05:30
hoppscotch-cli fix: resolve typos across packages (#4867) 2025-03-12 13:53:08 +05:30
hoppscotch-common chore(i18n): update tw translation (#4920) 2025-03-25 16:32:25 +05:30
hoppscotch-data fix: resolve typos across packages (#4867) 2025-03-12 13:53:08 +05:30
hoppscotch-desktop fix(relay): avoid override with header passthrough (#4931) 2025-03-25 16:34:27 +05:30
hoppscotch-js-sandbox feat: add support for Digest authorization (#4339) 2024-10-29 12:34:40 +05:30
hoppscotch-kernel fix(kernel): pre-req transformers for backcompat (#4883) 2025-03-17 14:28:49 +05:30
hoppscotch-relay feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
hoppscotch-selfhost-desktop fix: prevent dev server crashes due to breaking changes in the vue-i18n suite of tools 2025-03-18 12:29:18 +05:30
hoppscotch-selfhost-web fix(infra): deterministic env var ordering (#4893) 2025-03-19 16:08:47 +05:30
hoppscotch-sh-admin fix(infra): deterministic env var ordering (#4893) 2025-03-19 16:08:47 +05:30