Hoppscotch custom fork for personnal use
Find a file
Shreyas 3803735d28
fix(web): add explicit headers following prior normalization (#4951)
These changes add explicit `Content-Type` headers to direct (via `native` interceptor)
authentication requests after changes made in [PR #4931](https://github.com/hoppscotch/hoppscotch/pull/4931) that modified how `Content-Type`
headers are handled in the `relay` plugin.

In [issue #4905](https://github.com/hoppscotch/hoppscotch/issues/4905), that was about Hoppscotch Agent and Native interceptor inconsistently
handling `Content-Type` headers. The issue had two main manifestations,
duplicate headers - when overriding the `Content-Type` header in the UI or using OAuth2 authentication, the agent
would send multiple `Content-Type` headers to the web server. This caused undefined behavior
and often 400 errors for backends that don't accept duplicate headers.
And inconsistent overrides - even when the content type was explicitly set (for example to
`application/json;v=2`), the agent/native would inconsistently apply this override. Server
logs revealed that roughly 50% of requests would use the correct override value, while the
others would revert to the default `application/json`.

The two-part solution implemented first in [PR #4911](https://github.com/hoppscotch/hoppscotch/pull/4911) addressed the duplicate headers issue
by implementing header normalization before final relay. This prevented duplicate headers
with different casing from being sent and [PR #4931](https://github.com/hoppscotch/hoppscotch/pull/4931) then resolved the inconsistent override
behavior by removing the automatic `Content-Type` header insertion in the `ContentHandler`
component. As explained in the PR description, this was a temporary workaround until we
implement a HTTP/2-compliant solution with proper normalization.

While the fixes in PR #4911 and #4931 correctly resolved the header inconsistency issues
for general API requests, they introduced a new problem: **requests that previously relied
on the automatic `Content-Type` insertion now have no `Content-Type` header at all**.

This mainly affects direct calls around authentication flows in the desktop module, which
were using the `content.json()` functionality without explicitly setting `Content-Type`
headers, relying on the automatic insertion that has now been removed.

These changes add the now-required explicit `Content-Type` headers to three
authentication-related API calls in the desktop platform module:

- **The initial user details GraphQL query**:
```javascript
headers: {
  Authorization: `Bearer ${accessToken}`,
  "Content-Type": "application/json",
},
```

- **The magic link email submission endpoint**:
```javascript
headers: {
  "Content-Type": "application/json",
},
```

- **The token verification endpoint**:
```javascript
headers: {
  "Content-Type": "application/json",
},
```

This will make sure that authentication flows continue to work properly with the native
interceptor after the header handling changes.

As noted in [PR #4931](https://github.com/hoppscotch/hoppscotch/pull/4931), this is considered a **temporary solution**. The plan is to revisit the
content-type handling when we implement a more comprehensive HTTP/2-compliant header
normalization system in the kernel layer.

While HTTP/1.1 headers are case-insensitive
per [RFC 7230](https://tools.ietf.org/html/rfc7230), inconsistent handling across server implementations can treat differently-cased
variations as distinct headers. HTTP/2 ([RFC 7540](https://tools.ietf.org/html/rfc7540)) mandates converting all header field
names to lowercase, which would prevent these issues altogether. In such cases, relying
fully on `MediaType` interface from the kernel will help handling these edge-cases.
2025-04-04 14:45:05 +05:30
.devcontainer chore: make devcontainer copy .env.example (#3318) 2023-09-28 21:58:17 +05:30
.github chore: updated docker release ci 2025-03-19 12:50:59 +05:30
.husky chore: bump dependencies (#4444) 2024-10-24 03:25:55 +05:30
packages fix(web): add explicit headers following prior normalization (#4951) 2025-04-04 14:45:05 +05:30
.dockerignore feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
.editorconfig docs: better copy 2021-04-23 11:38:56 +00:00
.env.example feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
.envrc feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
.firebaserc Removed absolute Firebase files 2020-11-03 08:01:55 +05:30
.gitattributes chore: add .gitattributes 2022-03-28 22:37:36 +05:30
.gitignore feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
.npmrc chore: pin dependencies across packages (#3876) 2024-03-07 23:37:48 +05:30
.prettierignore docs: better copy 2021-04-23 11:38:56 +00:00
.prettierrc.js chore: bump dependencies (#3258) 2023-08-21 09:06:30 +05:30
aio-multiport-setup.Caddyfile feat: ability for aio in sub-path access configurations to specify alternate ports (#4480) 2024-10-29 00:05:52 +05:30
aio-subpath-access.Caddyfile feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
aio_run.mjs fix(infra): deterministic env var ordering (#4893) 2025-03-19 16:08:47 +05:30
CHANGELOG.md build: bump deps 2022-01-24 05:44:10 +05:30
CODE_OF_CONDUCT.md docs: updated screenshots and features list (#3310) 2023-09-05 12:06:47 +05:30
CODEOWNERS chore: update CODEOWNERS 2024-06-17 21:14:37 +05:30
commitlint.config.js feat: added commitlint, semantic pr 2021-06-28 00:24:16 +05:30
CONTRIBUTING.md chore: update CONTRIBUTING.md 2024-06-17 21:50:10 +05:30
devenv.lock feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
devenv.nix feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
devenv.yaml feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
docker-compose.deploy.yml build: enable the use of external DB for internal test deployments (#4625) 2024-12-18 15:33:18 +05:30
docker-compose.yml fix(infra): docker compose service dependencies (#4871) 2025-03-12 13:58:18 +05:30
firebase.json fix: broken Dockerfile and final start command 2022-12-02 13:34:46 -05:00
firestore.indexes.json Removed absolute Firebase files 2020-11-03 08:01:55 +05:30
firestore.rules refactor: updated firebase rules 2022-01-21 13:13:40 +05:30
healthcheck.sh chore: improve health check script (#4596) 2025-02-07 14:31:08 +05:30
jsconfig.json Revert "Revert "Migrate Postwoman to Nuxt.js (full Vue and SCSS support)"" 2019-08-24 22:09:29 +05:30
LICENSE docs: updated copyright year 2022-01-24 05:41:24 +05:30
netlify.toml chore: reintroduce updated auth mechanism 2023-02-07 19:21:06 +05:30
package.json chore: bump vulnerable dependencies (#4943) 2025-03-27 22:45:29 +05:30
pnpm-lock.yaml chore: bump vulnerable dependencies (#4943) 2025-03-27 22:45:29 +05:30
pnpm-workspace.yaml refactor: monorepo+pnpm (removed husky) 2021-09-10 00:28:28 +05:30
prod.Dockerfile chore: bump vulnerable dependencies (#4943) 2025-03-27 22:45:29 +05:30
README.md docs: link to the Desktop App (#4925) 2025-03-25 16:40:42 +05:30
SECURITY.md docs: use GitHub markdown alert formatting for note (#4666) 2025-02-07 14:31:08 +05:30
tailwind.config.ts feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
TRANSLATIONS.md docs: updated screenshots and features list (#3310) 2023-09-05 12:06:47 +05:30

Hoppscotch

Hoppscotch

Open Source API Development Ecosystem

contributions welcome Website Tests Tweet

Built with ❤︎ by contributors


Hoppscotch

We highly recommend you take a look at the Hoppscotch Documentation to learn more about the app.

Support

Chat on Discord Chat on Telegram Discuss on GitHub

Features

❤️ Lightweight: Crafted with minimalistic UI design.

Fast: Send requests and get responses in real time.

🗄️ HTTP Methods: Request methods define the type of action you are requesting to be performed.

  • GET - Requests retrieve resource information
  • POST - The server creates a new entry in a database
  • PUT - Updates an existing resource
  • PATCH - Very similar to PUT but makes a partial update on a resource
  • DELETE - Deletes resource or related component
  • HEAD - Retrieve response headers identical to those of a GET request, but without the response body.
  • CONNECT - Establishes a tunnel to the server identified by the target resource
  • OPTIONS - Describe the communication options for the target resource
  • TRACE - Performs a message loop-back test along the path to the target resource
  • <custom> - Some APIs use custom request methods such as LIST. Type in your custom methods.

🌈 Theming: Customizable combinations for background, foreground, and accent colors — customize now.

  • Choose a theme: System preference, Light, Dark, and Black
  • Choose accent colors: Green, Teal, Blue, Indigo, Purple, Yellow, Orange, Red, and Pink
  • Distraction-free Zen mode

Customized themes are synced with your cloud/local session.

🔥 PWA: Install as a Progressive Web App on your device.

  • Instant loading with Service Workers
  • Offline support
  • Low RAM/memory and CPU usage
  • Add to Home Screen
  • Desktop PWA

🚀 Request: Retrieve response from endpoint instantly.

  1. Choose method
  2. Enter URL
  3. Send
  • Copy/share public "Share URL"
  • Generate/copy request code snippets for 10+ languages and frameworks
  • Import cURL
  • Label requests

🔌 WebSocket: Establish full-duplex communication channels over a single TCP connection.

📡 Server-Sent Events: Receive a stream of updates from a server over an HTTP connection without resorting to polling.

🌩 Socket.IO: Send and Receive data with the SocketIO server.

🦟 MQTT: Subscribe and Publish to topics of an MQTT Broker.

🔮 GraphQL: GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.

  • Set endpoint and get schema
  • Multi-column docs
  • Set custom request headers
  • Query schema
  • Get query response

🔐 Authorization: Allows to identify the end-user.

  • None
  • Basic
  • Bearer Token
  • OAuth 2.0
  • OIDC Access Token/PKCE

📢 Headers: Describes the format the body of your request is being sent in.

📫 Parameters: Use request parameters to set varying parts in simulated requests.

📃 Request Body: Used to send and receive data via the REST API.

  • Set Content Type
  • FormData, JSON, and many more
  • Toggle between key-value and RAW input parameter list

📮 Response: Contains the status line, headers, and the message/response body.

  • Copy the response to the clipboard
  • Download the response as a file
  • View response headers
  • View raw and preview HTML, image, JSON, and XML responses

History: Request entries are synced with your cloud/local session storage.

📁 Collections: Keep your API requests organized with collections and folders. Reuse them with a single click.

  • Unlimited collections, folders, and requests
  • Nested folders
  • Export and import as a file or GitHub gist

Collections are synced with your cloud/local session storage.

📜 Pre-Request Scripts: Snippets of code associated with a request that is executed before the request is sent.

  • Set environment variables
  • Include timestamp in the request headers
  • Send a random alphanumeric string in the URL parameters
  • Any JavaScript functions

👨‍👩‍👧‍👦 Teams: Helps you collaborate across your teams to design, develop, and test APIs faster.

  • Create unlimited teams
  • Create unlimited shared collections
  • Create unlimited team members
  • Role-based access control
  • Cloud sync
  • Multiple devices

👥 Workspaces: Organize your personal and team collections environments into workspaces. Easily switch between workspaces to manage multiple projects.

  • Create unlimited workspaces
  • Switch between personal and team workspaces

⌨️ Keyboard Shortcuts: Optimized for efficiency.

Read our documentation on Keyboard Shortcuts

🌐 Proxy: Enable Proxy Mode from Settings to access blocked APIs.

  • Hide your IP address
  • Fixes CORS (Cross-Origin Resource Sharing) issues
  • Access APIs served in non-HTTPS (http://) endpoints
  • Use your Proxy URL

Official proxy server is hosted by Hoppscotch - GitHub - Privacy Policy.

🌎 i18n: Experience the app in your language.

Help us to translate Hoppscotch. Please read TRANSLATIONS for details on our CODE OF CONDUCT and the process for submitting pull requests to us.

☁️ Auth + Sync: Sign in and sync your data in real-time across all your devices.

Sign in with:

  • GitHub
  • Google
  • Microsoft
  • Email
  • SSO (Single Sign-On)1

🔄 Synchronize your data: Handoff to continue tasks on your other devices.

  • Workspaces
  • History
  • Collections
  • Environments
  • Settings

Post-Request Tests: Write tests associated with a request that is executed after the request's response.

  • Check the status code as an integer
  • Filter response headers
  • Parse the response data
  • Set environment variables
  • Write JavaScript code

🌱 Environments: Environment variables allow you to store and reuse values in your requests and scripts.

  • Unlimited environments and variables
  • Initialize through the pre-request script
  • Export as / import from GitHub gist
Use-cases
  • By storing a value in a variable, you can reference it throughout your request section
  • If you need to update the value, you only have to change it in one place
  • Using variables increases your ability to work efficiently and minimizes the likelihood of error

🚚 Bulk Edit: Edit key-value pairs in bulk.

  • Entries are separated by newline
  • Keys and values are separated by :
  • Prepend # to any row you want to add but keep disabled

🎛️ Admin dashboard: Manage your team and invite members.

  • Insights
  • Manage users
  • Manage teams

📦 Add-ons: Official add-ons for hoppscotch.

Add-ons are developed and maintained under Hoppscotch Organization.

For a complete list of features, please read our documentation.

Demo

Usage

  1. Provide your API endpoint in the URL field
  2. Click "Send" to simulate the request
  3. View the response

Developing

Follow our self-hosting documentation to get started with the development environment.

Contributing

Please contribute using GitHub Flow. Create a branch, add commits, and open a pull request.

Please read CONTRIBUTING for details on our CODE OF CONDUCT, and the process for submitting pull requests to us.

Continuous Integration

We use GitHub Actions for continuous integration. Check out our build workflows.

Changelog

See the CHANGELOG file for details.

Authors

This project owes its existence to the collective efforts of all those who contribute — contribute now.

License

This project is licensed under the MIT License — see the LICENSE file for details.


  1. Enterprise edition feature. Learn more. ↩︎