api-client/packages/hoppscotch-agent
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
..
public feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
src fix(agent): typescript build warnings (#4800) 2025-03-03 14:16:42 +05:30
src-tauri fix(relay): avoid override with header passthrough (#4931) 2025-03-25 16:34:27 +05:30
.gitignore feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
index.html feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
package.json chore: bump version to 2025.2.3 2025-03-19 14:41:08 +05:30
pnpm-lock.yaml feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
postcss.config.js feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
README.md feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
tailwind.config.js feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
tsconfig.json feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
tsconfig.node.json feat: hoppscotch agent and agent interceptor (#4396) 2024-10-03 20:26:30 +05:30
vite.config.ts feat(kernel): isolate type ser/de to platform (#4860) 2025-03-10 22:45:51 +05:30

Tauri + Vue + TypeScript

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.

Type Support For .vue Imports in TS

Since TypeScript cannot handle type information for .vue imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue imports (for example to get props validation when using manual h(...) calls), you can enable Volar's Take Over mode by following these steps:

  1. Run Extensions: Show Built-in Extensions from VS Code's command palette, look for TypeScript and JavaScript Language Features, then right click and select Disable (Workspace). By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
  2. Reload the VS Code window by running Developer: Reload Window from the command palette.

You can learn more about Take Over mode here.