#6543·hoppscotch

[Feat] Add Public Script

Author: Jengro777Created Jul 28, 2026Updated Sep 5, 2026

Describe the solution you'd like

I'd like to see collection-level pre-request scripts (similar to Postman) that can:

  1. Execute before each request in a collection
  2. Access request context (URL, method, body, headers)
  3. Modify request headers/body dynamically
  4. Read/write environment variables
  5. Support common crypto libraries (or at least native crypto.subtle / CryptoJS)

Optionally, a global script that runs for all requests (regardless of collection) would be even more powerful.

Describe alternatives you've considered

Current workarounds I've tried:

  • Using environment variables with static values – doesn't support dynamic computation
  • Manually generating signatures via browser console and pasting – tedious and breaks workflow
  • Switching to Postman/Insomnia – works, but I prefer Hoppscotch's UI and open-source nature
  • Using a local proxy (mitmproxy) to inject signatures – overkill for most teams

Example Use Case

I have 20+ endpoints under a collection called Payment Gateway API. Each endpoint requires these headers:

X-Timestamp: 1690000000000
X-Nonce: abc123def456
X-Signature: 3f8a9b2c...

With pre-request scripts, I could:

  1. Define SECRET_KEY in environment variables
  2. Write one script at collection level
  3. All 20+ endpoints automatically get valid signatures

This would save hours of manual work and eliminate copy-paste errors.

Additional Context

  • Hoppscotch version: [e.g., 2026.3.0 or self-hosted version]
  • Platform: Web / Desktop / Docker
  • Related discussions: #1873, #3538 (both closed but relevant)